Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.os.Build; public class Main { public static long getBitmapSize(Bitmap bitmap) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // API19 // return bitmap.getAllocationByteCount(); // } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {// API12 return bitmap.getByteCount(); } return bitmap.getRowBytes() * bitmap.getHeight(); // earlier version } }