Answers for "java convert url/image to drawable"

0

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);
}
Posted by: Guest on November-07-2021

Code answers related to "java convert url/image to drawable"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language