Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.os.Build; public class Main { /** * Returns the in memory size of the given {@link Bitmap}. */ public static int getSize(Bitmap bitmap) { if (Build.VERSION.SDK_INT >= 19) { return bitmap.getAllocationByteCount(); } else { return bitmap.getHeight() * bitmap.getRowBytes(); } } }