Stop Preloading Pages In Viewpager Example
I am looking for and example source code for stop pre-loading pages in viewpager. Normally android viewpager loads the next and previous page(s) automatically. My target is to use
Solution 1:
Like you already know there is no way of stopping viewpagers from loading . The only way out is to use this method setUserVisibleHint add this to your fragment, and do all the animation you want to in this method
@OverridepublicvoidsetUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
// animate hereLog.e(TAG, "animate here");
}else{
Log.e(TAG, "fragment is no longer visible");
// fragment is no longer visible
}
}
This will be called only when that particular tab is visible to user.
Post a Comment for "Stop Preloading Pages In Viewpager Example"