0

I have a game where four images are displayed, the user answers a question and then re-display four different ones. I display images creating a Bitmap and load them from assets folder.

Which is the best practice, call the method removeAllViews() of the view and recreate the images or change pictures with setImageBitmap. Thanks.

Jose19589
  • 81
  • 3

1 Answers1

0

Look at this source code: android.widget.ImageView#updateDrawable(Drawable)

Old Drawable will be replaced by the new one. Garbage Collector frees the allocated memory sometime later. Unless you are holding somewhere the reference to the old image (List, Map, etc...).

alex
  • 8,904
  • 6
  • 49
  • 75