【发布时间】:2015-06-04 23:01:31
【问题描述】:
我正在构建一个列表视图,并使用 map.put 获取我想要的 HashMap 的图像的 URI。
获取 URI 的函数工作正常,我可以使用 setImageURI(uri) 设置图像视图。
我应该在 map.put("flag", value); 中使用什么值;
以下代码是后执行的一部分
try {
android = json.getJSONArray(TAG_OS);
oslist.clear();
for(int i = 0; i < android.length(); i++){
JSONObject c = android.getJSONObject(i);
String counter = c.getString(TAG_COUNTER);
String id = c.getString(TAG_ID);
String phono = c.getString(TAG_PHONO);
String error = c.getString(TAG_ERROR);
cur.moveToFirst();
cur.moveToPosition(i);
name = cur.getString(cur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
Uri uri = getPhotoUri(Long.parseLong(fetchContactIdFromPhoneNumber(phono)));
HashMap<String, String> map = new HashMap<String, String>();
map.put("flag", value);
map.put(TAG_COUNTER, name);
map.put(TAG_ID, id);
map.put(TAG_PHONO, phono);
map.put(TAG_ERROR, error);
oslist.add(map);
list=(ListView)findViewById(R.id.lv_addcontact);
ListAdapter adapter = new SimpleAdapter(MainActivity.this, oslist,
R.layout.list_item,
new String[] {"flag",TAG_COUNTER, TAG_PHONO, TAG_ERROR}, new int[] {
R.id.flag,R.id.txtView_name, R.id.txtview_number, R.id.txtview_check});
list.setAdapter(adapter);
}
}
感谢大家的帮助
【问题讨论】:
标签: java android image hashmap uri