How to pass the value into php from android? -
How to pass the value into php from android? -
i'm facing problem passing value php script android.
i want questionid
pass php script url_get_ansurl
can't pass value.
how this? please guide me.
thanks lot.
seek { int success = json.getint(tag_success); if (success == 1) { system.out.println("success"); groups = json.getjsonarray(tag_group); system.out.println("result success+++"+groups); (int = 0; < groups.length();i++) { jsonobject c = groups.getjsonobject(i); string question = c.getstring(tag_ques); system.out.println("checking ::"+question); ques1.add(question); string questionid = c.getstring(tag_quesid); system.out.println("checking ::"+questionid); id=questionid; quesid.add(questionid); } } else { showalert(); } } grab (jsonexception e) { system.out.println("error "+e.tostring()); } list<namevaluepair> params1 = new arraylist<namevaluepair>(); params1.add(new basicnamevaluepair("qid", qid)); json = jsonparser.makehttprequest(url_get_ansurl, "get", params1); system.out.println("ques value got"); log.d("all groups: ", json.tostring()); system.out.println("question"); seek { int success = json.getint(tag_success); system.out.println("success"); if (success == 1) { system.out.println("success"); groups = json.getjsonarray(tag_group); system.out.println("result success+++"+groups); (int = 0; < groups.length();i++) { jsonobject c = groups.getjsonobject(i); string reply = c.getstring(tag_answ); system.out.println("checking ::"+answer); answ1.add(answer); } } else { showalert(); } } grab (jsonexception e) { system.out.println("error "+e.tostring()); } protected void onpostexecute(string file_url) { pdialog.dismiss(); ques1=new arraylist<string>(new arraylist<string>(ques1)); // j=0; textview txtque = (textview) findviewbyid(r.id.que_txt); txtque.settext(ques1.get(j));
you can utilize post or get
list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("questionid", questionid)); seek { httpparams httpparameters = new basichttpparams(); httpconnectionparams.setconnectiontimeout(httpparameters, 10000); httpconnectionparams.setsotimeout(httpparameters, 10000); httpclient httpclientpost = new defaulthttpclient(httpparameters); //httpget post = new httpget(url_request); httppost post = new httppost(url_request); urlencodedformentity ent = new urlencodedformentity(params, http.utf_8); post.setentity(ent); httpresponse responsepost = httpclientpost.execute(post); httpentity resentity = responsepost.getentity(); string getresponse = entityutils.tostring(resentity); //response server } grab (ioexception e) { e.printstacktrace(); } grab (jsonexception e) { e.printstacktrace(); }
php android json params
Comments
Post a Comment