title: View pager and fragment lifecycle
body: <p>I have a ViewPager that loads three pages at a time. If I swipe from page 1 to page 2 then to 3, the first page(fragment) goes to  <code>onPause()</code>. Then, if I swipe to the second page, 1st page comes to <code>onResume()</code> even though the page 1 is still not visible to the user. So, my question is: how to distinguish between the first and second page in code? For example, if I have to run a piece of code when the fragment is visible, how is that done?</p>