but I need to load one page at a time because memory problems.
That presumes that you are getting OutOfMemoryError
s.
Am i going to have to use the old style tabhost etc?
Yes, or FragmentTabHost
, or action bar tabs.
or is there a way/hack I can make my viewPager load one page at a time?
No, for the simple reason that ViewPager
needs more than one page at a time for the sliding animation. You can see this by using a ViewPager
and swiping.
Or, you can work on fixing your perceived memory problems. Assuming this app is the same one that you reported on earlier today, you are only using 7MB of heap space. That will only result in OutOfMemoryError
s if your remaining heap is highly fragmented. There are strategies for memory management (e.g., inBitmap
on BitmapOptions
for creating bitmaps from external sources) that help address such fragmentation concerns.
My Adapter extends BaseAdapter with the ViewHolder patern.
BaseAdapter
is for use with AdapterView
, not ViewPager
.