I really need to load 1 item only at a time and destroy the other pages if that is not the current selected page. How am I able to do that? Is there any Custom that is not deprecated and able to perform that?
Asked
Active
Viewed 1,110 times
0
-
Check [this](https://stackoverflow.com/a/44405015/2196176) I hope it will help you. – Sunny Aug 26 '18 at 13:13
-
Yeah I tried it and most of its method are deprecated like it uses setOnPageListener instead of the new addOnPageListener. I also refactor while my code reference is the original ViewPager it for some hour to make it updated but then throws an error while casting to a LayoutParams which is I do not know how to fix it. – Mihae Kheel Aug 26 '18 at 13:17
-
if you are using fragments you can use `setUserVisibleHint` https://developer.android.com/reference/android/support/v4/app/Fragment#setUserVisibleHint(boolean) – prashant17 Aug 26 '18 at 14:57
-
@prashant17 I tried it but it seems like the memory gets doomed if there is too many item to load. – Mihae Kheel Aug 26 '18 at 15:08