Could someone point me in the right direction to get a ImageView inside this SimpleAdapter? The TAG_IMAGE should be the Imageview. I am getting this: Type missmatch: Cannot convert from ImageView to int. And yes I am a noob.
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);
}
});
Main.xml with the given below code
listview_layout.xml and update the content with the given below code
MainActivity.java with the given below code
Run the application