Resources for Android: how are bitmaps loaded from memory-processed resources?

When you load a bitmap from these resources:

iv.setImageResource(R.drawable.image); 
  • If the bitmap is downsized with Scaletype, will it retain the entire original bitmap? (I would assume yes, because you can change the Scaletype on the fly, and you would like to have full quality.)
  • If you load the same resource identifier into multiple ImageViews, is there only one raster map stored in memory?
  • Would it be a good check in the hierarchy of views and manually process these bitmaps (by extracting BitmapDrawable from the ImageView) into onDestroy or can I be sure that this is done on time by the system?
+6
source share
1 answer
  • Yes, it will maintain full quality.
  • No, it will support one object.
  • This will be done by the System. No need to worry. But, he waits until some buffer is filled with data for calling the GC. As soon as the buffer is filled with unwanted data, then objects will be deleted from memory at a time. If you still want, you can take care.
0
source

Source: https://habr.com/ru/post/911093/


All Articles