My app uses a BottomNavigationBar to switch between Fragments, and it does it this way: I want those Fragments to be static, so their content and views do not dissapear when I switch between them. I have tried to create them inside MainActivity’s onCreate() method, but it only helps with retaining text inside EditText widgets, the rest of the views
Tag: android-menu
How can I change option menu in different fragments?
I have a Fragment with menu: I would like to change menu but it doesn’t work and keep the old action menu Fragment B is equals like above with different inflate XML menu. EDITED: Can be useful to use different menu layout for different fragments and 1 menu layout for main activity and differents id Answer Put setHasOptionsMenu(true) in constructor