Android examples for Graphics:Bitmap File
get Bitmap By File and Bitmap.Config.ARGB_8888
//package com.java2s; import android.graphics.*; import android.util.Log; public class Main { private static final String TAG = "BitmapCustomUtils"; public static Bitmap getBitmapByFile(String profilePicturePath, Bitmap defaultIcon) {/*from w w w . j a v a2 s . co m*/ try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = BitmapFactory.decodeFile(profilePicturePath, options); return bitmap != null ? bitmap : defaultIcon; } catch (Exception e) { Log.e(TAG, "cannot load profile picture - set the default one " + e.getMessage()); } return defaultIcon; } }