Hello. There is a file in JSON format. It contains an array of objects, each object contains a "name" field and an "image" field, in which the url is specified to load the image. I want to display the object name and image in the ListView. For this, I use the ImageManadger class from this article. I tried different ways, but nothing happens. A huge request to show how I can upload images from a file in ListView. Thank you in advance
try { JSONArray data = new JSONArray(result); ArrayList<HashMap<String, Object>> MyArrList = new ArrayList<HashMap<String, Object>>(); HashMap<String, Object> map; for(int i = 0; i < data.length(); i++){ JSONObject c = data.getJSONObject(i); map = new HashMap<String, Object>(); map.put("name", c.getString("name")); ImageView imgView = (ImageView) findViewById(R.id.imageView1); ImageManager.fetchImage(c.getString("image"), imgView); imgView.buildDrawingCache(); Bitmap bmap = imgView.getDrawingCache(); d = new BitmapDrawable(bmap); map.put("image",d); map.put("image2",c.getString("image")); MyArrList.add(map); } SimpleAdapter simpleadapter; simpleadapter = new SimpleAdapter(SecondActivity.this, MyArrList, R.layout.list, new String[] { "name", "image"}, new int[] { R.id.myName, R.id.imageView1}); listView.setAdapter(simpleadapter); }