android - download images and implement gridview -


i have several string arrays downloading text data mysql server on android client app.i able display title text (f_name) listview.how download corresponding images each text kept in seperate folder on server(correct path folder available,let url).i need display images along titles names f_name[] gridview.what changes should make?pls edit code , show me exact code,thanks in advance. java class , xml file:

public class mainmenu extends listactivity { inputstream is; @override public void oncreate(bundle savedinstancestate) {   super.oncreate(savedinstancestate);   string result = ""; try{     httpclient httpclient = new defaulthttpclient();     httppost httppost = new httppost(my url);     httpresponse response = httpclient.execute(httppost);      httpentity entity = response.getentity();     = entity.getcontent();     log.e("log_tag", "connection success ");  }catch(exception e){     log.e("log_tag", "error in http connection "+e.tostring());}  try{     bufferedreader reader = new bufferedreader(new inputstreamreader(is,"iso-8859-1"),8);     stringbuilder sb = new stringbuilder();     string line = null;     while ((line = reader.readline()) != null) {             sb.append(line + "\n");     }     is.close(); result=sb.tostring();} catch(exception e){    log.e("log_tag", "error converting result "+e.tostring()); toast.maketext(getapplicationcontext(), "fail1", toast.length_short).show();} try{     jsonarray jarray = new jsonarray(result);     int arraylength=jarray.length();     string f_name[]=new string[arraylength];     string f_id[]=new string[arraylength];     string f_avail[]=new string[arraylength];     string f_descp[]=new string[arraylength];     string f_cost[]=new string[arraylength];     for(int i=0;i<arraylength;i++){            jsonobject json_data = jarray.getjsonobject(i);            f_id[i]=json_data.getint("f_id")+"";            f_name[i]=json_data.getstring("f_name");            f_descp[i]=json_data.getstring("f_descp");            f_avail[i]=json_data.getstring("f_avail");            f_cost[i]=json_data.getint("f_cost")+"";} setlistadapter(new arrayadapter<string>(this, r.layout.menu, f_name)); listview lv = getlistview(); lv.settextfilterenabled(true);lv.setonitemclicklistener(new onitemclicklistener() {   public void onitemclick(adapterview<?> parent, view view,   int position, long id) { toast.maketext(getapplicationcontext(), ((textview) view).gettext(),     toast.length_short).show();}});}     catch(jsonexception e){         log.e("log_tag", "error parsing data "+e.tostring());         toast.maketext(getapplicationcontext(), "fail"+e.tostring(), toast.length_short).show(); } }} 


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -