java - Create ArrayAdapter -


i need arrayadapter listview contain image , 2 fields, can not figure out how it. can try make this

arrayadapter adapter = new arrayadapter(this, r.layout.list, new arraylist<arraylist<string>>{           tmp,                           wallresults.get("text"),                          }, new int[]{                      r.id.text1,                        r.id.text2}); 

but it's not work

this list.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="wrap_content"   android:orientation="vertical"   android:layout_height="wrap_content">     <linearlayout   android:layout_width="265dip"   android:orientation="vertical"   android:layout_height="wrap_content">    <textview android:layout_width="fill_parent"   android:layout_height="wrap_content"   android:id="@+id/text1"   android:textsize="25dip"   android:text="this text1"/>    <textview android:layout_width="fill_parent"   android:layout_height="wrap_content"   android:id="@+id/text2"   android:text="this text2"/>    <imageview android:layout_width="fill_parent"   android:layout_height="wrap_content"   android:id="@+id/text2"   android:text="this text2"/>     </linearlayout>   </linearlayout> 

array adapter allows 1 filed using arrayadapter can use simpleadapter class insted.

arraylist<string> listtext1 = new arraylist<string>();     listtext1.add("a");     listtext1.add("b");     listtext1.add("c"); arraylist<string> listtext2 = new arraylist<string>();     listtext2.add("x");     listtext2.add("y");     listtext2.add("z");  list<map<string, string>> alist = new arraylist<map<string, string>>(); map<string, string> map; int count = items.size(); for(int = 0; < count; i++) {     map = new hashmap<string, string>();     map.put("txt1", listtext1.get(i));     map.put("txt2", listtext2.get(i));     alist .add(map); }  simpleadapter adapter = new simpleadapter(this, list, r.layout.list, new string[] { "txt1", "txt2" }, new int[]{r.id.text1, r.id.text2}); 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -