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
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
protected int sizeOf(Bitmap data) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
return data.getRowBytes() * data.getHeight();
} else {
return data.getByteCount();
}
}