Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; public class Main { public static Config getBitmapConfig(Drawable drawable) { return drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; } }