Skip to content Skip to sidebar Skip to footer

Android: Image Reading From Url

After seeing all the examples from net, i have written the follwoing code to read an image from the URL, show it to the Image view and save it to the path specified. publi

Solution 1:

consider this example its show how to create image from url

URLurl=newURL(Your Image URL In String); 
            HttpURLConnectionconnection= (HttpURLConnection) url.openConnection();
            connection.setDoInput(true);
            connection.connect();
            InputStreaminput= connection.getInputStream();
            BitmapmyBitmap= BitmapFactory.decodeStream(input);
             yourImageView.setImageBitmap(myBitmap);

Solution 2:

you should implement a retry when the connection was failed.

Post a Comment for "Android: Image Reading From Url"