How can I determine/calculate the byte size of a bitmap (after decoding with BitmapFactory)?
I need to know how much memory space it occupies, because I’m doing memory caching/management in my app. (file size is not enough, since these are jpg/png files)
Thanks for any solutions!
Update: getRowBytes * getHeight might do the trick.. I’ll implement it this way until someone comes up with something against it.
getRowBytes() * getHeight()seems to be working fine to me.Update to my ~2 year old answer:
Since API level 12 Bitmap has a direct way to query the byte size:
http://developer.android.com/reference/android/graphics/Bitmap.html#getByteCount%28%29
—-Sample code