> > 1) Does ImageView.SetImageResource applied against the same id twice or > thrice consumes memory for the same bitmap or uses a separate range for > every imageview element ? >
I don't quite understand your question. When a Bitmap is loaded as a Drawable (which is what ImageView does), it gets cached by the system (using weak references.) This means that if do this: Drawable d1 = loadDrawable(R.drawable.myImage); Drawable d2 = loadDrawable(R.drawable.myImage); you will get 2 different instances of Drawable, but the underlying Bitmap will be loaded in memory only once. 2) same as 1. but for BitmapFactory.decodeResource > Every time you call this method you will load a new instance of a Bitmap object, which means you will use more memory. > 3) What part of Bitmap object consumes the most memory. If it's "backbone > memory object" than what is it ? Where can I elucidate the structure of > bitmap memory for myself ? > A Bitmap is backed by a byte array containing all the pixels. This is what consumes the most memory. As of Android 3.0, this byte array can be found in Bitmap.java, in previous versions of the platform the pixel storage exists on the native side (you'd have to investigate SkBitmap.cpp.) -- Romain Guy Android framework engineer [email protected] -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

