我試圖通過一個hashmap在listview中顯示一些String []值。當我去嘗試顯示這個,自己的arent顯示的值,但顯示的數字的隨機顯示[Ljava.lang.String; @ .....「]我的相關代碼如下:HashMap顯示字符串[]在ListView中
//NEW TEST STUFF
feedList= new ArrayList<HashMap<String, String[]>>();
map = new HashMap<String, String[]>();
//TEST ARRAYS
a = new String[] {"a","b"};
b = new String[] {"c", "d"};
//NEW STUFF
simpleAdapter = new SimpleAdapter(this, feedList, R.layout.list_view, new String[]{"one", "two"}, new int[]{R.id.companyListViewColumn, R.id.colorListViewColumn});
map.put("one", a);
map.put("two", b);
feedList.add(map);
crossReferenceListView.setAdapter(simpleAdapter);
。
是什麼原因造成這種???
嘗試更改訂單。先寫map.put(),然後再寫simpleAdapter = new .... – Apurva 2015-02-23 03:49:08