A problem has been encountered in the recent project:
Background: Use Viewpager+fragment to make the first page slide, then need to automatically pop up the dialog box when the third fragment is selected.
Workaround:
1, in
Vp.setonpagechangelistener (New Onpagechangelistener () { @Override public void onpageselected (int arg0) { //arg0 is the location of the current fragment, you can handle some business. }
}
2, Frgment provides a method
@Override public void Setuservisiblehint (Boolean isvisibletouser) { logutil.i ("TAG", " Setuservisiblehint ("+ Isvisibletouser +") "); To a display state of true, not visible as false if (Isvisibletouser) { } super.setuservisiblehint (Isvisibletouser); }
3, Viewpager inside the View list, and then when no view is selected, bind the corresponding fragment.
Android Viewpager + fragment check current fragment to trigger some things again.