Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.text.TextUtils; import java.net.URL; public class Main { public static Bitmap getBitmapFromUrl(String imageUrl) { Bitmap bmp = null; try { if (!TextUtils.isEmpty(imageUrl) && imageUrl.startsWith("http")) { URL url = new URL(imageUrl); bmp = BitmapFactory.decodeStream(url.openStream()); } else { bmp = BitmapFactory.decodeFile(imageUrl); } } catch (Throwable ex) { } return bmp; } }