android ListView ItemClick get the Child Text -


i have made custom listview which extends listactivity , each row contains 2 textview , button.

adapter = new simpleadapter(this, arraylist, r.layout.simplelistcustom, new string[] { "count","title"},                  new int[] {r.id.invisible, r.id.textview11 });         setlistadapter(adapter); 

when clicking on list view row ,i selected row index , using index row child

protected void onlistitemclick(listview listview, view view, int position, long id)     {          super.onlistitemclick(listview, view, position, id);          string selection = listview.getitematposition(position).tostring();    } 

the output when displayed in "selection" in logcat

{count=6, title=etywewetr} 

problem want seperate content....how can possible....plz help

thanx in advance

the getitematposition method returning element arraylist parameter; need cast correct type. assuming arraylist list<map<string, string>> (which suspect is):

protected void onlistitemclick(listview listview, view view, int position, long id) {      super.onlistitemclick(listview, view, position, id);      map<string, string> selection = (map<string, string>) listview.getitematposition(position);      string count = selection.get("count");      string title = selection.get("title"); } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -