Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.drawable.Drawable; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; public class Main { public static Drawable getDrawable(String urlpath) { Drawable d = null; try { URL url = new URL(urlpath); URLConnection conn = url.openConnection(); conn.connect(); InputStream in; in = conn.getInputStream(); d = Drawable.createFromStream(in, "background.jpg"); // TODO Auto-generated catch block } catch (IOException e) { e.printStackTrace(); } return d; } }