【发布时间】:2016-10-17 10:49:36
【问题描述】:
我正在尝试通过 AsyncHttpClient 的 post 方法以 json 格式将数据发送到服务器,服务器接受此格式
{
email : 'foo@bar.com'
password:'xxxxxx'
'username:'John Doe'
'lastname:'john'
}
这是我的代码
JSONObject params = new JSONObject();
params.put("last_name","Karimi");
params.put("username","zahid");
params.put("email","zahid.omerzad@gmail.com");
params.put("password","1234566");
StringEntity entity = new StringEntity(params.toString());
Log.d("entity3",entity+"");
String url = "http://192.168.100.12/users";
client.post(context, url, entity, "application/json", handler);
当我记录实体时,结果如下所示
[Content-Type: text/plain; charset=ISO-8859-1,Content-Length: 496,Chunked: false]
请帮帮我?
【问题讨论】:
-
试试this
-
在下面的链接中检查我对相同问题的回答。 stackoverflow.com/questions/37468403/…
-
我没有用凌空,我用的是AsyncHttpClient
标签: java android json android-async-http loopj