Kleptine
Kleptine

Reputation: 5085

Android Force Recycle Large Bitmap?

From another stackoverflow question, it seems that Android handles large bitmaps differently than other memory. It also seems like there is a way to force Android to recycle the bitmaps to free up memory. Can anyone enlighten me on how to do this.

My application uses 2-6 huge bitmaps at all times, so it nearly kills the phone's memory when running, and I want to clear it up when the user quits.

Upvotes: 2

Views: 2891

Answers (3)

Jaiprakash Soni
Jaiprakash Soni

Reputation: 4112

Check answer in this post how to compress image for imageview in android you can extract thumbnails of your images and use them as bitmap. After calling bitmap.recycle() you can use System.gc(); to call the garbage collector

Upvotes: 0

thiagolsilva
thiagolsilva

Reputation: 439

Be sure if anybody is not using the Bitmap before call the method recycle(). If anybody is using the Bitmap and you try recycle, one exception is call.

Upvotes: 0

Kleptine
Kleptine

Reputation: 5085

Lol. Just found the bitmap.recycle() method. Never mind.

Upvotes: 11

Related Questions