It's my first project. When i use Post,I can't send the data to server.
Here is my code:
JSONObject json = new JSONObject();
try
{ json.put("_username", mUsername);
json.put("_password", mPassword);
String s=json.toString();
System.out.println("string: " + s);
StringEntity se = new StringEntity( s,HTTP.UTF_8);
System.out.println("0.string: " + se);
se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded"));
System.out.println("1.string: " + se);
httpRequest.setEntity(se);
And it catch (Exception e)
Here is logcat:
07-05 13:09:57.731 16809-16809/com.ad_imagine.jsonconnection I/System.out: string: {"_username":"lorem@ipsum.fr","_password":"aze"}
07-05 13:09:57.733 16809-16809/com.ad_imagine.jsonconnection I/System.out: 0.string: org.apache.http.entity.StringEntity@3117948
07-05 13:09:57.733 16809-16809/com.ad_imagine.jsonconnection I/System.out: 1.string: org.apache.http.entity.StringEntity@3117948
07-05 13:09:57.768 16809-16809/com.ad_imagine.jsonconnection I/System.out: 6.Exception: null
What is org.apache.http.entity.StringEntity@3117948
? Why 0.string is not correct?