I know the Android platform is a huge mess, over complicated and over-engineered, but seriously to get the size of a bitmap, is it really necessary to do all those conversio
As mentioned in other answers, it is only available on API 12 or higher. This is a simple compatibility version of the method.
public static int getByteCount(Bitmap bitmap) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
return bitmap.getRowBytes() * bitmap.getHeight();
} else {
return bitmap.getByteCount();
}
}