When I change to landscape mode, few objects are created with bitmap of full screen.
When I scroll the other object is called and its bitmap is displayed, when I doing this repeatedly , bitmap size exceeds vm
budget error, I have done all the things like recycle()
, set null and then called GC()
, still I have same error. creating bitmap....
bitmap = Bitmap.createBitmap(ChartProperties.getChartWidth(),
ChartProperties.getChartHeight(),
Bitmap.Config.RGB_565);
imageCache.put(String.valueOf(LandscapeChartActivity.getActiveFeature()),
new SoftReference(bitmap));
if(imageCache != null){
for (int i = 0; i < imageCache.size(); i++) {
if (imageCache.get(String.valueOf(i)) != null) {
imageCache.get(String.valueOf(i)).get().recycle();
imageCache.put(String.valueOf(i), null);
}
}
Runtime.getRuntime().gc();
imageCache.clear();
imageCache = null;