java - Android Post request not posting any data on server -


=====updated========
below code fine, problem @ server side.
=====updated========

below code,i using httpurlconnection not able send json data server.

please me in advance

 jsonobject jo = new jsonobject();     jo.put("id", "25")     log.e("test", jo.tostring());      url = new url(url);     connection = (httpurlconnection) url.openconnection();     connection.setrequestmethod("post");     connection.setrequestproperty("content-type", "application/json");      connection.setusecaches(false);     connection.setdoinput(true);     connection.setdooutput(true);      //send request     dataoutputstream wr = new dataoutputstream(     connection.getoutputstream());     wr.writebytes(jo.tostring());      wr.flush();     wr.close();      //get response     inputstream = connection.getinputstream();     bufferedreader rd = new bufferedreader(new inputstreamreader(is));      string line;     stringbuffer sb = new stringbuffer();     int chr;     while ((chr = is.read()) != -1) {     sb.append((char) chr);     }     line = sb.tostring();     log.e("json_temp", line);     rd.close(); 

your code fine, doesn't show blank array, string "array()". tried resource test, , that's showed me. if type in url in browser, should see same thing. resource test


Comments