android - How to show images and text with listview from web site -
I use JSW to parse the HTML page and I have to show text and images in the listing view. So I have created LinkedHashMap and SimpleAdapter for this. Apart from this, besides text shows, images are not shown for every time I get the log message like: "Ury's wrong bitmap failed on Yuri" I tried to lose this problem but still solve it can not be done.
Here is the code:
@Override protected string doInBackground (string ... arg) {document document; Try {doc = Jsoup.connect ("http://thesiteiuse.com/news/") .get (); Title = doc.select ("h2 [class = et_pt_title]"); Image = doc.select ("img"); ListViewContent.clear (); (Element title: title) for {map & lt; String, Object & gt; Map = New Linkedheap & lt; String, Object & gt; (); Map.put (ATTRIBUTE_NAME_TEXT, titles.text ()); ListViewContent.add (map); } (Element IMG: Picture) {bitmap bitmap; Click the & lt; String, Object & gt; PicMap = New LinkedHashp & lt; String, Object & gt; (); String iurl; Iurl = img.absUrl ("src"); Logs. W ("ABSL:", IUTL.OustString ()); Url url = new url (iurl); Bitmap = bitmapfinder Aodestream (url.openstream ()); Log.w ("bitmap", bitmap.toString ()); PicMap.put (ATTRIBUTE_NAME_IMAGE, String.valueOf (bitmap)); ListViewContent.add (picMap); }} Hold (IOException e) {e.printStackTrace (); } Return tap; }
How do I solve my problem? What is the easier way to display images in the ListView than the app URL?
You have to make your adapter
to listview
for. You should see this tutorial on how to create it:
Comments
Post a Comment