My View Pager consists of photos,audios and videos.Audio View consists of play button to play the audio.When i click on play button it disappears and audio start playing.When I stop the audio or when track is completed play button again becomes visible. If i swipe the view while audio is being played and move to next view then the audio stops.But the issue is if I move to next view by swiping while the audio is being played and then return to the audio view then i can't see the play button on View Pager.However if i swipe to next to next view or to further next views and then return to the audio view then i can see the play button on Audio View.Same happens for back also.If I move to previous view by swiping from audio view while audio is being played and then return to the audio view the i can't see the play button on View Pager.However if i swipe to previous to previous view or to further previous views and then return to the audio view then i can see the play button on View Pager..
The reason is that when the fragment 0 is active, then Android also initiates the adjacent fragments, in this case only 1. When you swipe to fragment 1, since fragment 0 is already initiated, android only initiates fragment 2. This is the reason when you move back from fragment 1 to fragment 0, you do not see the play button.
Now when you move to fragment 2 and then back to fragment 1, fragment 0 will get refreshed, hence you can see the button again.
Honestly, I have struggled with the same problem. This has been discussed in StackOverflow multiple times. I found the following post to be most useful.