How to show a MenuItem from a custom Fragment
I have a SearchView in my onCreateOptionsMenu() that I hide using:
if(mState == 0){
msearchMenuItem.setVisible(false);
}
I want it to be true after I access a custom Fragment that is part of a
ViewPager in:
setMenuVisibility(boolean menuVisible){
}
I understand that I cannot pass a reference of the MenuItem to my Fragment
because the ActionBar is not a layout, and all of its process needs to be
from the MainActivity.
My option was to change the value of mState from setMenuVisibility() in my
Fragment, but It shows the SearchView after I interact with my
DrawerLayout. If I don't touch the home button, it would never show the
SearchView.
Now, what can I do to load it exactly when I am in the Fragment?
No comments:
Post a Comment