I just have a little ListView
containing all installed apps and their icons
but if there are too much Apps installed i run into outOfMemoryErrors
while doing
Drawable app_icon = applicationInfoList.get(i).loadIcon(context.getPackageManager()));
that for every ListEntry
(this line is written in my ListAdapter
)
no problem so far, i understand why i ran into this error (too much icons loaded, too few vm heap)
but i had a look at the source code of androids ManageApplications
Activity in the settings
and i never run in any of those oom errors while using the settings ManageApps
but the weird thing is that they do it EXACTLY THE SAME WAY
as you can see in their source here:
the ManageApplications
activity
where the Drawable icon
gets loaded
where it is set in the list view
but i really dont understand why do i get a oom and they dont?
Solved it myself.
I'm now loading every image into a cache before using it.
If the cache gets full, the oldest element will be discarded,
so new ones can get cached. additionally im resizing my images into smaller icons.
that did it.
Resize your icons into small images, you will be fine! (had this problem before, too)