Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Build; public class Main { public static int getDrawableSize(Drawable drawable) { if (drawable == null) { return 0; } Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); } else { return bitmap.getRowBytes() * bitmap.getHeight(); } } }