i am showing 150+ images in viewpager, when page size crossed 70 app is crashing , all images are loading from network , and i have fallowed [link]: Strange out of memory issue
Sheetal,
As requested, I use the above code as follows:
In my FragmentActivity I do the following in the onCreate() method:
pager = (ViewPager)findViewById(R.id.pager);
imageAdapter = new MyPagerAdapter(this, pager, theResources, listOfIds.pageBitMapIds);
imageAdapter.setRecentListener(this);
pager.setAdapter(imageAdapter);
Then in my PagerAdapter I do the following:
@Override
public Object instantiateItem(ViewGroup container, int position) {
MyFragment myFragment = new MyFragment(resources, resourceIds[position], recentListener, position);
myFragments[position] = myFragment;
return super.instantiateItem(container, position);
}
@Override
public Fragment getItem(int position) {
return myFragments[position];
}
And then I use the code in my previous answer above.
This is obviously not complete code and it has been adapted from my actual code, but it should give you a good idea of what to do and where to do it.
Mark