Here you can find the source of getBitmap(Context c, String uri, int minsizeDP)
public static Bitmap getBitmap(Context c, String uri, int minsizeDP)
//package com.java2s; import java.io.InputStream; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.provider.ContactsContract; public class Main { public static Bitmap getBitmap(Context c, String uri, int minsizeDP) { InputStream input = ContactsContract.Contacts .openContactPhotoInputStream(c.getContentResolver(), Uri.parse(uri), true); Bitmap bitmap = BitmapFactory.decodeStream(input); if (bitmap != null && bitmap.getScaledHeight(c.getResources() .getDisplayMetrics()) < minsizeDP) { int newsize = Math .round(c.getResources().getDisplayMetrics().density * minsizeDP); bitmap = Bitmap.createScaledBitmap(bitmap, newsize, newsize, true);/* w w w . jav a 2 s. co m*/ } return bitmap; } }