1

How do I implement a listview which displays images an text dynamically from the web? Each image has some descriptions to it and I need them to display correctly in each list. The images change every once in a while. So I have to retrieve up to date contents.

I have read this, but have no idea how to include text into it. Any help here?

Thanks.

Community
  • 1
  • 1
Hend
  • 589
  • 5
  • 15
  • 35

2 Answers2

2

Here you will find full details and along with Full working Source code

Android lazy image loader example

Arslan Anwar
  • 18,746
  • 19
  • 76
  • 105
  • hi. the image url are all currently all static for the example. the image url for mine changes and will not be the same at any point of time. any dynamic solution for this? – Hend Nov 22 '11 at 04:17
  • This example is for dynamic image loading. All what you need to do is to create object of ImageLoader in you listAdapter constructor. Then in getView make a call to imageLoader.DisplayImage(...); Or if you need more help, then please share your code. – Arslan Anwar Nov 22 '11 at 05:42
  • Hi, sorry but Im not too sure about what you mean by creating object of ImageLoader.. And where do I insert the url of the webpage? – Hend Nov 23 '11 at 12:39
  • Read the tutorial in detail. You will get your answer. – Arslan Anwar Nov 23 '11 at 13:19
  • From what I understand from the short paragraphs, I have to include my own method of reading the url as well as the text content? Then store them in their individual arrays e.g. mStrings[] and lStrings[]? Am I on the right track? Anyway, I've tried to create a method to read the urls. But am unable to store them in private mStrings[]. – Hend Nov 24 '11 at 01:18
  • I am unable to understand what you are asking now. If you like then we can have a chat about your problem. – Arslan Anwar Nov 24 '11 at 05:52
  • would love to but haven't got enough reps to do so. Anyway, I wanna ask if: #1 Am I supposed to create individual methods to search the image url as well as the text content? #2 Unsure of how to store the url/content into private mStrings[] if I'm doing a method public String getURL(). – Hend Nov 24 '11 at 08:45
0

Use an ListView Adapter like here: http://android.amberfog.com/?p=296. The getView Method is executed for every row of your ListView, so you have to place your code to load the images right there When the Data changes simply call notifyDataSetChanged on the ListView Adapter and the ListView will refresh (executs getView again).

Thommy
  • 5,070
  • 2
  • 28
  • 51