String path = "https://ic.snssdk.com/user/mobile/login/v2/";
OkHttpClient httpClient = new OkHttpClient();
FormBody body = new FormBody.Builder()
.add("mobile", et_phone.getText().toString().trim())
.add("password", et_pwd.getText().toString().trim())
.build();
Request request = new Request.Builder()
.url(path)
.post(body)
.build();
Call call = httpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.isSuccessful()) {
/*解析*/
Gson gson = new Gson();
LoginBean loginBean = gson.fromJson(response.body().string(), LoginBean.class);
<span style="white-space:pre"> </span>}
}
});