Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.os.Build; public class Main { /** * TODO doc * * @param data * @return */ private static int byteSizeOf(Bitmap data) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) { return data.getRowBytes() * data.getHeight(); } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return data.getByteCount(); } else { return data.getAllocationByteCount(); } } }