Android examples for Graphics:Drawable Read
get Drawable from Url
//package com.java2s; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.util.Log; public class Main { @SuppressWarnings("deprecation") public static Drawable getUrlDrawable(String url) { try {/* www . ja va 2 s. c o m*/ URL aryURI = new URL(url); URLConnection conn = aryURI.openConnection(); InputStream is = conn.getInputStream(); Bitmap bmp = BitmapFactory.decodeStream(is); return new BitmapDrawable(bmp); } catch (Exception e) { return null; } } }