Do we have to explicitly recycle the bitmap if we don't need it?

Bitmap has a recycle method, but do we have to invoke it explicitly if we don't need it any more?

For example, an ImageView has a bitmap now. When user click a button, it will set a new bitmap to the ImageView.

Do we have to recycle the original bitmap before assign the new one?

Answers


yes you have if you are targeting devices with Android older the 3.0. That's will avoid you to incour in the OutOfMemoryException.

Note: Before android 3 the Bitmap memory is allocated in the native heap. The java object will retains low memory from the GC perspective.


Need Your Help

Broadcast Receiver for Notification or Notification Sound

android notifications broadcastreceiver audio

I would like to know if it has how to catch an event, for example: I have a service, this one has a listener (catch notification or catch sound notification) and I need intercept the default sound ...

How do I hide bullets in LaTeX lists?

latex

Semantically, I want an itemized list, but visually I just want some space. How can I hide the bullets?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.