Here you can find the source of downloadBitmap(URI uri)
private static Bitmap downloadBitmap(URI uri)
//package com.java2s; import java.io.BufferedInputStream; import java.io.InputStream; import java.net.URI; import java.net.URLConnection; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Log; public class Main { private static final String TAG = "SOHelper"; private static Bitmap downloadBitmap(URI uri) { try {/*from ww w. j a v a 2s .c om*/ URLConnection connection = uri.toURL().openConnection(); connection.connect(); InputStream is = connection.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is, 8 * 1024); Bitmap bmp = BitmapFactory.decodeStream(bis); bis.close(); is.close(); return bmp; } catch (Exception ex) { Log.w(TAG, "couldn't download image (" + ex.getMessage() + ")"); return null; } } }