K
K
kirawa2018-03-14 10:51:31
Android
kirawa, 2018-03-14 10:51:31

How to recreate data in ViewPager?

Good afternoon. I have a ViewPager with a FragmentStatePagerAdapter. Which has onCreateOptionsMenu.
From any viewPager item, I have a menu button in the tolbar, by clicking on which we go to another fragment (A). But when I go back from the fragment (A) to the viewPager, clicking on the menu does not call onOptionsItemSelected, it only calls if I rewind the viewPager's items to re-create. It all worked with
FragmentPagerAdapter - but because of it there were problems with android 4.1 and 8.0 so I switched to FragmentStatePagerAdapter. How to create a menu in this case?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question