I have an application with one activity one fragment class and five viewgroups. To start with I pass the first viewgroup to my fragment class and when a certain area in the viewgroup is touched a call is sent up to the activity to notify it that the next viewgroup should be loaded. I call getFragmentSupportManager().beginTransaction() then replace the old fragment with the next one using fragmentTransaction.replace(R.id.primaryContainerView, currentFragment, "Title"); Some of my viewgroups have up to 20 images associated with them and the background for each is being set using imageView.setImageResource(mContext, R.drawable.myImage); The first time I run my app everything works great but sometimes on subsequent runs it throws an outofmemory exception. Some of the ImageViews use pictures up to 1733x1017 because they're background images and several of the Viewgroups have their backgrounds replaced before sending a call to 5 he main activity to load the next viewgroup. How can I make sure my images are recycled properly so I don't get the outofmemory?
Asked
Active
Viewed 1,692 times
0
-
possible duplicate of [Out of Memory Error ImageView issue](http://stackoverflow.com/questions/10200256/out-of-memory-error-imageview-issue) – rds Jul 30 '15 at 09:24
1 Answers
0
this section here might help you out:
http://developer.android.com/training/displaying-bitmaps/manage-memory.html

Dave
- 867
- 6
- 11