I have a trouble related to viewpager. In my apps I am taking current view as a image but in viewpager when I use this view as a image in page it show next view. Because of I have read viewpager automatically load next view. please suggest me..
Asked
Active
Viewed 2,855 times
1 Answers
3
If I understand correctly you want to load only current page. It's not possible. ViewPager is loading next and previous pages accordingly to
viewPager.setOffscreenPageLimit()
. Min and default value is 1 so you have loaded current page, next and previous.

Karol Żygłowicz
- 2,442
- 2
- 26
- 35
-
Thanks Karol you got my question correctly. I want to load only current page. have you give me any logic if its not possible my viewpager methods. – Sazid Ali Jul 24 '15 at 12:13
-
actually i want to get current page screen as a image but it return next page image because it contains next page view. – Sazid Ali Jul 24 '15 at 12:18
-
As I said as far as im concerned there is no way to load only current page using ViewPager class. Its the way it works. When you are in the middle of swipping for next page you can already see the next page because it was loaded before. You can't intercept that. – Karol Żygłowicz Jul 24 '15 at 12:20
-
Actually I am trying with bad logic means I am storing all loded view in arraylist then use listview.get(size-2) for getting current view. but it is not working when user scroll some previous pages. – Sazid Ali Jul 24 '15 at 12:37
-
something like this? http://stackoverflow.com/questions/12854783/android-viewpager-get-the-current-view – Karol Żygłowicz Jul 24 '15 at 12:42
-
I think you can create a custom ViewPager which should override setOffScreenPageLimit(); method – droidev Oct 18 '16 at 15:11