i new bee in android , knowledge regarding android not vast, ok lets come point, need make login username , password, have make http requset json , in return response come in json. can can me please in it. thanks.
try out code
button show_data; jsonobject my_json_obj; string path,firstname,lastname; path = "http://192.168.101.123:255/services/services.php?id=9"; httpclient client = new defaulthttpclient(); httpconnectionparams.setconnectiontimeout(client.getparams(), 10000); httpentity entity; httpresponse response = null; httpurlconnection urlconn; my_json_obj = new jsonobject(); try { urlconn = (httpurlconnection) new url(path).openconnection(); urlconn.setconnecttimeout(10000); urlconn.setdooutput(true); outputstreamwriter writer = new outputstreamwriter(urlconn.getoutputstream(), "utf-8"); my_json_obj.put("susername", "test2"); my_json_obj.put("spassword", "123456"); writer.write(my_json_obj.tostring()); writer.close(); if(true) { string temp; temp = webrequestcall(my_json_obj); //log.i("reply", temp); }
Comments
Post a Comment