java convert url/image to drawable
public static Drawable drawableFromUrl(String url) throws IOException { Bitmap x; HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.connect(); InputStream input = connection.getInputStream(); x = BitmapFactory.decodeStream(input); return new BitmapDrawable(Resources.getSystem(), x); }
Source: stackoverflow.com