[Android] Set ArrayAdapter of ArrayList with Hashmap

  • 0
how to set an ArrayList<HashMap<String,String>> in an ArrayAdapter
其實非常簡單! 只要跟 ArrayAdapter 先說好就可以了
附上一個帶有圖的 ListView 例子: Android - 基礎筆記(四) ListView圖文、按鈕

ArrayList<HashMap<String,String>> items =
        new ArrayList<HashMap<String,String>>();

ArrayAdapter<HashMap<String, String>> ad =
        new ArrayAdapter<HashMap<String,String>>(this,
            android.R.layout.simple_list_item_1,items);   
// don't forget to make corresponding layout

沒有留言 :

張貼留言