I use UIL to load deleted images and fill fragments in the FragmentStatePagerAdapter. I read readme and common errors, but I can not solve this error.
Here is the configuration:
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .threadPoolSize(1) .build(); ImageLoader.getInstance().init(config);
Here I show my images:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ImageLoader imgLoader = ImageLoader.getInstance(); DisplayImageOptions options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.loading) .cacheOnDisc() .resetViewBeforeLoading() .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .build(); imgLoader.displayImage(this.contentImage, this.imgView, options); return layout; }
And this is where I will destroy my fragments in the adapter:
public void destroyItem(ViewGroup container, int position, Object object) { if (position >= getCount()) { container.removeAllViews(); FragmentManager manager = ((Fragment) object).getFragmentManager(); FragmentTransaction trans = manager.beginTransaction(); trans.remove((Fragment) object); trans.commit(); } }
and finally, this is what I get:
{ 06-20 12:09:24.877: E/dalvikvm-heap(17043): Out of memory on a 6345504-byte allocation. 06-20 12:09:24.877: I/dalvikvm(17043): "pool-1-thread-1" prio=4 tid=16 RUNNABLE 06-20 12:09:24.877: I/dalvikvm(17043): | group="main" sCount=0 dsCount=0 obj=0x42593a48 self=0x6367e778 06-20 12:09:24.887: I/dalvikvm(17043): | sysTid=17091 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1667639656 06-20 12:09:24.887: I/dalvikvm(17043): | state=R schedstat=( 4021618000 2254117000 18267 ) utm=341 stm=61 core=0 06-20 12:09:24.887: I/dalvikvm(17043):
I do not know how to solve it. Uploaded images are resized. They can range from 500 KB to 1.5 MB.
source share