Why Is My Android.r.id.home Not Called In My Fragment?
I'm currently using FragmentStatePagerAdapter and I would like it to have a 'navigate up' feature (DisplayHomeAsUpEnabled). When I set the following code it shows up as a correct n
Solution 1:
Try adding: setHasOptionsMenu(true); in your onCreate() in ShareholdingFragment.
Solution 2:
Add setHomeButtonEnabled(true)
on API Level 14 and higher when you configure your action bar. On API Level 11-13, the home button is enabled automatically.
Solution 3:
If you're using the new Toolbar and ActionbarDrawerToggle. You can assign clickHandler directly. For my activities that have this drawer toolbar I implemented an interface to enable drawer if at root,
@OverridepublicvoidenableDrawer(boolean enable) {
mDrawerToggle.setDrawerIndicatorEnabled(enable);
mDrawerToggle.setToolbarNavigationClickListener(newView.OnClickListener() {
@OverridepublicvoidonClick(View v) {
// Pop fragment back stack or pass in a custom click handler from the fragment.
}
});
}
Post a Comment for "Why Is My Android.r.id.home Not Called In My Fragment?"