Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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);
}
Comment

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);
}
Comment

PREVIOUS NEXT
Code Example
Java :: setimageuri crash 
Java :: java interface 
Java :: find the unique element in a list java 
Java :: dowload htpasswd file java 
Java :: thread priorities in java 
Java :: java check if int is null 
Java :: make a textarea not editable javafx 
Java :: regex pattern for valid identifiers 
Java :: date to yyMMdd conversion 
Java :: How to make a Java Main Menu Loop after using a case 
Java :: java list remove 
Java :: hwo to create a list of 1 to n nums in java list 
Java :: no java virtual machine found after searching the following locations 
Java :: how to add data into list model in android 
Java :: char value java 
Java :: android list tostring 
Java :: java noverify 
Java :: string java 
Java :: Pattern Programs in Java. 
Java :: spring logback configuration 
Java :: find out duplicate number between 1 to n numbers in java 
Java :: how to make a rest api in spring 
Java :: java continue statement 
Java :: random number 
Java :: how to get ascii value of string letter in java 
Java :: multithreading in java 
Java :: Java Remove HashMap Elements 
Java :: how to add element to dictionary 
Java :: can we override the overloaded method in java 
Java :: java to kotlin 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =