Here you can find the source of getDrawableFromUrl(String url)
public static Drawable getDrawableFromUrl(String url) throws Exception
//package com.java2s; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import android.graphics.drawable.Drawable; public class Main { public static Drawable getDrawableFromUrl(String url) throws Exception { return Drawable.createFromStream(getRequest(url), null); }//from w ww .j a v a 2s .co m public static InputStream getRequest(String path) throws Exception { URL url = new URL(path); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(5000); if (conn.getResponseCode() == 200) { return conn.getInputStream(); } return null; } }