有人能指出我在这个SimpleAdapter中获得ImageView的正确方向吗?TAG_IMAGE应该是Imageview.我得到这个:类型失配:无法从ImageView转换为int.是的,我是一个菜鸟.
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
AllProductsActivity.this, productsList,
R.layout.list_item, new String[] { TAG_PID,
TAG_NAME, TAG_PRICE, TAG_RANDOM, TAG_IMAGE },
new int[] { R.id.pid, R.id.name, R.id.price,
R.id.random, R.id.image });
// Imageview to show
// updating listview
setListAdapter(adapter);
}
});
Run Code Online (Sandbox Code Playgroud)