Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.os.Build; public class Main { /** * Method to get the number of bytes of the source Bitmap. * * @param source The source Bitmap. * @return The number of bytes of the source Bitmap. */ private static int byteSizeOf(Bitmap source) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) { return source.getRowBytes() * source.getHeight(); } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return source.getByteCount(); } else { return source.getAllocationByteCount(); } } }