Skip to content Skip to sidebar Skip to footer

Regarding Download Image From Url In Android

I am developing an android application in which i have data coming from Url,The url has 3 images,along with text.I want to show all the images in list along with text.I looked at t

Solution 1:

You need to use custom Adapter for Listview to bind text with image as list item. Refer the below links: Lazy load of images in ListView http://negativeprobability.blogspot.com/2011/08/lazy-loading-of-images-in-listview.html

Solution 2:

This could help you.

Bitmap bmImg;
voiddownloadFile(String fileUrl){
      URL myFileUrl =null;          
      try {
           myFileUrl= new URL(fileUrl);
      } catch (MalformedURLException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
      }
      try {
           HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
           conn.setDoInput(true);
           conn.connect();
           InputStream is = conn.getInputStream();

           bmImg = BitmapFactory.decodeStream(is);
           imView.setImageBitmap(bmImg);
      } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
      }
 }

Source : http://en.androidwiki.com/wiki/Loading_images_from_a_remote_server

See this too

http://ballardhack.wordpress.com/2010/04/05/loading-remote-images-in-a-listview-on-android/

Post a Comment for "Regarding Download Image From Url In Android"