php - Send data to server with Volley Lib in Android -
i've developed application i'm going send data phone server json
, use volley
library in android.
can not send data server!
my simple php code :
$name = $_get["name"]; $j = array('name' =>$name); echo json_encode($j);
my java code :
private void makejsonobjectrequest() { mrequestqueue = volley.newrequestqueue(this); string url = "http://my-site-name/sampleget.php"; stringrequest jsonobjreq = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string response) { log.d("result:", response); toast.maketext(getapplicationcontext(), response, toast.length_short).show(); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { volleylog.d("err", "error: " + error.getmessage()); makejsonobjectrequest(); } }) { @override protected map<string, string> getparams() { map<string, string> params = new hashmap<>(); params.put("name", "json"); return params; } }; mrequestqueue.add(jsonobjreq); }
it got link below : click see link
but still not use , send data mobile server!!!
how can this? please give me correct , how use it
i did gist on while hope can help. won't me uploading images, sending example of can see on line:
entitybuilder.addtextbody("someparameter", params.tostring());
in gist use apache httpclient 4 volley. link gist here.
Comments
Post a Comment