I'd like to load images from json data which contains the url to these images into a listview,,, the class implementing the json data has the following code:
ArrayList<HashMap<String,String>> mylist = new ArrayList<HashMap<String,String>>();
//JSONfunctions j1 = new JSONfunctions();
JSONObject j2=JSONfunctions.getJSONfromURL("/newwebsite/apis/index.php?device=iphone&api=store_list");
try{JSONArray myID=j2.getJSONArray("stores");
//JSONArray mc = json.getJSONArray("mc");
for(int i=0;i<myID.length();i++){
Log.v("state","json data being read");
JSONObject j3= myID.getJSONObject(i);
String name = j3.getString("StoreTitle");
JSONObject j4= myID.getJSONObject(i);
//String name2 = j4.getString("StoreLogo");
String imgurl = j4.getString("StoreLogo");
//map.put("img",+StoreLogo);
//URL newurl = new URL(j4.getString("StoreLogo"));
String name1 = j4.getString("Address");
Log.v("Address",name1);
Log.v("Storetitle",name);
HashMap<String,String> map=new HashMap<String,String>();
JSONObject im = myID.getJSONObject(i);
map.put("Id",String.valueOf(i));
map.put("Storename","Store"+j3.getString("StoreTitle"));
//map.put("img","http"+j3.getString("StoreLogo") );
mylist.add(map);
}}
catch(JSONException e){
Log.e("loG_tag","Error parsing"+e.toString());
}
list=(ListView)findViewById(R.id.mclist);
// WebAdapter jAdap=new WebAdapter(context);
ListAdapter adapter = new SimpleAdapter(this,mylist,R.layout.custom_row_view1,
new String[] {"Storename","add","img"},
new int[] {R.id.mCname,R.id.mCcity,R.id.mClogo});
list.setAdapter(adapter);
and the json data is in the format
{"error":false,"totalresults":8,"stores":[{"StoreId":"38","StoreTitle":"Young & Jacksons","StoreLogo":"http:\/\/pocketdocket.com.au\/newwebsite\/uploads\/store\/1330635669night-young-and-jacksons-billboard.jpg","
where StoreLogo is the url to the image.
Any help would be greatly appreciated.