安卓xutils使用post方式的用法

2025年05月05日 10:54
有1个网友回答
网友(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() {

@Override
public void onFailure(HttpException error, String msg) {
// TODO Auto-generated method stub

}

@Override
public void onSuccess(ResponseInfo 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());
}
);