android - simpleAdapter thumbnail and text and onItemClick handler -


In my app, I need to show the list of thumbnails from my relative title. I have my implementation here.

  string template targets; & Lt; Maps & LT; String, Object & gt; & Gt; Data = new arreelist & lt; Maps & lt; String, Object & gt; & Gt; (); For (int i = 0; i  

I have two problems: 1. The simplest adapter shows me the title only, but not the thumbnail. 2. I do not know how to handle onItemClick, I have to archive the title. In this way I have a warning of Classcast Accident and Asanti Dali. Here is the layout of a row and list view.

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; RelativeLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "50dp" Android: orientation = "horizontal" & gt; & Lt; ImageView Android: id = "@ + id / imageView" Android: layout_width = "65dp" Android: layout_height = "65dip" /> & Lt; TextView Android "Android: attr / textAppearanceMedium" id = "@ + id / titoloTv" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_toRightOf = "@ id / imageView" Android textAppearance = / & gt; & Lt; / RelativeLayout & gt;  

and

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: orientation = "vertical" & gt; & Lt; Button android: id = "@ + id / creaButton" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: Layout_gravity = "Center_horizontal" Android process of creating text = "Una Nuova realtà aumentata" / & gt; & Lt; TextView android: id = "@ + id / textView1" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: Layout_gravity = "Center_horizontal" android: text = "Ar già making" Android: textAppearance = "? Android: Attr / textAppearanceLarge "/> & Lt; ListView Android: id = "@ + id / listView1" Android: layout_width = "match_parent" Android: layout_height = "match_parent" & gt; & Lt; / ListView & gt; & Lt; / LinearLayout & gt;  

Thanks

Click on item list list, t one hash map is stored to create ArrayList again by which you can get in your ArrayList of hashmap .. so

  listView.setOnItemClickListener (new AdapterView.OnItemClickListener () {@Override Public void needs to be changed onItemClick (AdapterView & LT;? & Gt; Adapter, Ultimate Visual Component, Integer Position, Long ID) {String title = data.get (POS) .Get ("Titolo"); String thumbimage = Data.get (pOS) .Ge T ("thumbnail"); RegisterForrentexMenu (component); component. ShowContextMenu ();}});  

Comments