use of com.juns.health.net.loopj.android.http.JsonHttpResponseHandler in project wechat by motianhuo.
the class RegisterActivity method getCode.
private void getCode() {
String phone = et_usertel.getText().toString();
RequestParams params = new RequestParams();
params.put("telephone", phone);
params.put("codeType", "1");
netClient.post(Constants.SendCodeURL, params, new JsonHttpResponseHandler() {
@Override
public void onSuccess(JSONObject response) {
super.onSuccess(response);
try {
String result = response.getString("result");
System.out.println("返回的值" + response);
if (result == null) {
Utils.showLongToast(App.getInstance(), Constants.NET_ERROR);
} else if (result.equals("Y")) {
String str = response.getString("value");
Utils.showLongToast(App.getInstance(), str);
} else {
String str = response.getString("value");
Utils.showLongToast(App.getInstance(), str);
mc.cancel();
btn_send.setEnabled(true);
btn_send.setText("发送验证码");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
Aggregations