android - image now display on screen when json parsing -


im try disse json sheet below , source code probem text wil show image try load url in json sheet image not show blank scrreen show se image http://imgur.com/hsyqtyd

{     "worldpopulation":      [         {             "rank":1,             "name": "breakfast",             "url": "http://www.androidbegin.com/tutorial/flag/china.png"         },         {                "rank":2,             "name": "lunch ",             "url": "http://www.androidbegin.com/tutorial/flag/china.png"         },         {               "rank":3,             "name": "supper",             "url": "http://www.androidbegin.com/tutorial/flag/china.png"         }     ] }  public void parsejsondata(){     //categoryapi = utils.categoryapi+"?accesskey="+utils.accesskey;         categoryapi = utils.categoryapi;             cleardata();     try {                     httpclient client = new defaulthttpclient();         httpconnectionparams.setconnectiontimeout(client.getparams(), 15000);         httpconnectionparams.setsotimeout(client.getparams(), 15000);         httpurirequest request = new httpget(categoryapi);         httpresponse response = client.execute(request);         inputstream atominputstream = response.getentity().getcontent();         bufferedreader in = new bufferedreader(new          inputstreamreader(atominputstream));          string line;         string str = "";         while ((line = in.readline()) != null) {             str += line;         }                 jsonobject json = new jsonobject(str);         jsonarray data = json.getjsonarray("worldpopulation");          (int = 0; < data.length(); i++) {             jsonobject object = data.getjsonobject(i);                              //jsonobject category = object.getjsonobject("category");                                 category_id.add(long.parselong(object.getstring("rank")));             category_name.add(object.getstring("name"));             category_image.add(object.getstring("url"));             log.d("category name", category_name.get(i));          }                               } catch (malformedurlexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (ioexception e) {         // todo auto-generated catch block         ioconnect = 1;         e.printstacktrace();     } catch (jsonexception e) {         // todo auto-generated catch block         e.printstacktrace();     }    }  class categorylistadapter extends baseadapter {     private activity activity;     private imageloader imageloader;      public categorylistadapter(activity act) {         this.activity = act;         imageloader = new imageloader(act);     }      public int getcount() {         // todo auto-generated method stub         return categorylist.category_id.size();     }      public object getitem(int position) {         // todo auto-generated method stub         return position;     }      public long getitemid(int position) {         // todo auto-generated method stub         return position;     }      public view getview(int position, view convertview, viewgroup parent) {         // todo auto-generated method stub         viewholder holder;          if(convertview == null) {             layoutinflater inflater = (layoutinflater) activity.getsystemservice(context.layout_inflater_service);             convertview = inflater.inflate(r.layout.category_list_item, null);             holder = new viewholder();              convertview.settag(holder);         } else {             holder = (viewholder) convertview.gettag();         }           holder.txttext = (textview) convertview.findviewbyid(r.id.txttext);         holder.imgthumb = (imageview)          convertview.findviewbyid(r.id.imgthumb);          holder.txttext.settext(categorylist.category_name.get(position));          imageloader.displayimage(utils.adminpageurl+categorylist.category_image.get(position), activity, holder.imgthumb);          return convertview;     }      static class viewholder {         textview txttext;         imageview imgthumb;     }         } 

you have download image , show in image view


Comments