I have 2 formats of action bar, I want to hide home action bar when I am in detail page and want to hide detail action bar when I am in home page. When I start the app, it directs me to home page and it shows me home action bar without showing detail action bar as I expected. I click something on home page that directs me to detail page and when I am on detail page, it also shows detail action bar without showing home action bar as I expected. But trouble comes when I get back to home page again using up button, it doesn't show the home action bar. So the home page doesn't have any action bar displayed. Why using show() doesn't bring back the home action bar?
I would suggest to change from relying on the detail fragment to set the home activity's action bar and instead rely on the home activity to set its own action bar.
For example:
In the onPause() of the home activity, you could add
supportActionBar?.hide().
Then in the onResume() of the home
activity you could add the line supportActionBar?.show().
Try that out and see if that works.
Related
hey can somebody teach me the most simple way to create Bottom Navigation bar On will Pop ?for example we are in home tab and checking the post shop... with press back button we should not exit from the app . and we also can back to icon navigation bar Respectively like Instagram . for ex we are in search tab and when I want to press back , I should see home Tab Thanks
In my app in some fragments I want to display status bar and in some fragments I want to hide the status bar. These all fragments are attached to the same activity.
I am able to hide the status bar for fragment ONE and show the status bar for fragment Two
The problem I am facing is when I navigate back from fragment TWO to the fragment ONE then status bar is not hiding.
If you hide the system bars in your activity's onCreate() method and the user presses back, the system bars will reappear. When the user reopens the fragment, onCreate() won't get called, so the system bars will remain visible. If you want system UI changes to persist as the user navigates in and out of your activity, set UI flags in onResume() or onWindowFocusChanged().
You can find more info here:
http://developer.android.com/training/system-ui/status.html
I hope it is useful.
So I've been working on and Android app that has a Sherlock action Bar on the top and that part is working fine but now I want to be able to dynamically add Menu Items to the Sherlock Action Bar.
I have to display log in name on screen if user is log in.
Suppose on Activity A I have Log in Button. When that button is clicked then LoginActivity starts. After log in B activity is start. If user pressed back button from activity B then Activity A again starts. But menu items name is not displays. For that I am using onCreateOptionsMenu method.
Maybe this should help you:
What onPrepareOptionsMenu do?
i.e., use onPrepareOptionsMenu() method
As in new action bars, when user clicks on any activity on dashboard, app will take user to new activity, at the same time along with home icon in action bar there would be an arrow showing this activity been started from other activity. How to get this feature with Sherlock android bar?
home icon in action bar there would be an arrow showing this activity been started from other activity
That is not what that arrow means. That arrow means that you are giving the user an option of moving "up" a navigation hierarchy, in addition to the BACK button offering navigation back to the preceding activity. This is described in greater detail in the Android Design documentation.
How to get this feature with Sherlock android bar?
The same way you do with the native action bar: call setDisplayHomeAsUpEnabled(true) on the ActionBar.
i changed the logo to an action icon and i want to perform an action when the logo is clicked.
How can i customize the action when the home logo in action bar is clicked?
thank you
In onOptionsItemSelected() of your activity, watch for an ID of android.R.id.home -- that will be when the home icon/logo is pressed. You can then perform whatever action makes sense (e.g., move to your app's main screen).