user1004521
user1004521

Reputation: 3

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 the some sample url along with lazy loading,code,,,,can anyone guide me how to do this

It is the url http://www.harpreetvirk.com/PMEvents/PMe.svc/Speakers

Regards

Upvotes: 0

Views: 2639

Answers (2)

Senthil Mg
Senthil Mg

Reputation: 3313

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

Upvotes: 2

gtiwari333
gtiwari333

Reputation: 25146

This could help you.

Bitmap bmImg;
void downloadFile(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/

Upvotes: 2

Related Questions