android - Issue on httpost, send multiple variables -


i have code here, now, i'm able send value parameter, can't send others.

what should in order send other values of edittext type? i.e want able send : mbiemer httpost method...but how..

thanks

public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.home_layout);     value=(edittext)findviewbyid(r.id.edittext1);     mbiemer=(edittext)findviewbyid(r.id.msgmbiemer);     telefon=(edittext)findviewbyid(r.id.msgtelefon);     adresa=(edittext)findviewbyid(r.id.msgadresa);     ora=(edittext)findviewbyid(r.id.msgora);     per=(edittext)findviewbyid(r.id.msgper);     dyqan=(edittext)findviewbyid(r.id.msgdyqan);     statusi=(edittext)findviewbyid(r.id.msgstatusi);      btn=(button)findviewbyid(r.id.button1);     pb=(progressbar)findviewbyid(r.id.progressbar1);     pb.setvisibility(view.gone);     btn.setonclicklistener(this); }  @override public boolean oncreateoptionsmenu(menu menu) {     getmenuinflater().inflate(r.menu.main, menu);     return true; }  public void onclick(view v) {     // todo auto-generated method stub     if(value.gettext().tostring().length() < 1) {         // out of range         toast.maketext(this, "please enter something", toast.length_long).show();     } else {         pb.setvisibility(view.visible);         new myasynctask().execute(value.gettext().tostring());       } }  private class myasynctask extends asynctask<string, integer, double> {      @override     protected double doinbackground(string... params) {         // todo auto-generated method stub         postdata(params[0]);         return null;     }      protected void onpostexecute(double result){     pb.setvisibility(view.gone);     toast.maketext(getapplicationcontext(), "command sent", toast.length_long).show(); }  protected void onprogressupdate(integer... progress){     pb.setprogress(progress[0]); }  public void postdata(string valueiwanttosend) {     // create new httpclient , post header     httpclient httpclient = new defaulthttpclient();     httppost httppost = new httppost("http://192.168.10.28/app/app1.php");      try {         // add data         list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>();         namevaluepairs.add(new basicnamevaluepair("myhttpdata", valueiwanttosend));         httppost.setentity(new urlencodedformentity(namevaluepairs));          // execute http post request         httpresponse response = httpclient.execute(httppost);      } catch (clientprotocolexception e) {         // todo auto-generated catch block     } catch (ioexception e) {         // todo auto-generated catch block     } }  } } 

you cannot send mbiemer because not sending it

change code this

public void postdata() { // create new httpclient , post header httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://192.168.10.28/app/app1.php");  try {     // add data     list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>();     namevaluepairs.add(new basicnamevaluepair("myhttpdata", value.gettext().tostring()));     namevaluepairs.add(new basicnamevaluepair("mbiemer", mbiemer.gettext().tostring()));     httppost.setentity(new urlencodedformentity(namevaluepairs));      // execute http post request     httpresponse response = httpclient.execute(httppost);  } catch (clientprotocolexception e) {     // todo auto-generated catch block } catch (ioexception e) {     // todo auto-generated catch block } 

and call postdata(); in doinbackground


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -