Android开发怎么用xutilspost数组到后台
Android开发,后台需要我发送一个数组过去,参数为data,里面有tel,password和code三个字段,我用xutils框架,请问怎么做?大概写几句,谢谢。...
Android开发,后台需要我发送一个数组过去,参数为data,里面有tel,password和code三个字段,我用xutils框架,请问怎么做?大概写几句,谢谢。
展开
1个回答
展开全部
HttpUtils http = new HttpUtils();
RequestParams params = new RequestParams();
// params.addHeader("余友Content-Type", "application/json");
params.addBodyParameter("tel", tel);
params.addBodyParameter("password", password);
params.addBodyParameter("code", code);
http.send(HttpRequest.HttpMethod.POST, url,new RequestCallBack<String>() {
@Override
public void onFailure(HttpException error, String msg) {
//陪毁庆 TODO Auto-generated method stub
}
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
/芦握/ TODO Auto-generated method stub
System.out.println(responseInfo.result);
}
@Override
public void onStart() {
// TODO Auto-generated method stub
super.onStart();
System.out.println("请求路径===" + this.getRequestUrl());
}
);
RequestParams params = new RequestParams();
// params.addHeader("余友Content-Type", "application/json");
params.addBodyParameter("tel", tel);
params.addBodyParameter("password", password);
params.addBodyParameter("code", code);
http.send(HttpRequest.HttpMethod.POST, url,new RequestCallBack<String>() {
@Override
public void onFailure(HttpException error, String msg) {
//陪毁庆 TODO Auto-generated method stub
}
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
/芦握/ TODO Auto-generated method stub
System.out.println(responseInfo.result);
}
@Override
public void onStart() {
// TODO Auto-generated method stub
super.onStart();
System.out.println("请求路径===" + this.getRequestUrl());
}
);
追问
哥们儿,我这边需要传过去一个data啊
追答
就data data data是什么类型的啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询