org.json.JSONException:类型为java.lang.String,无法转换为JSONObject

时间:2016-08-04 06:36:25

标签: java android-studio

我想用Facebook的蓝色背景色等背景色为我的手机应用上色。那么它的十六进制代码是什么?

Response.Listener<String> responseListener = new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    try {
                        JSONObject jsonResponse = new JSONObject(response);
                        boolean success = jsonResponse.getBoolean("success");
                        if (success) {
                            Intent intent = new Intent(register.this, login.class);
                            register.this.startActivity(intent);
                        } else {
                            AlertDialog.Builder builder = new AlertDialog.Builder(register.this);
                            builder.setMessage("Register Failed")
                                    .setNegativeButton("Retry", null)
                                    .create()
                                    .show();
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            };

public RegisterRequest(String first_name, String last_name, String e_mail, String user_name, String date_of_birth, String gender, String password, String confirm_password, Response.Listener<String> listener) {
    super(Method.POST, REGISTER_REQUEST_URL, listener, null);
    params = new HashMap<>();
    params.put("first_name", first_name);
    params.put("last_name", last_name);
    params.put("e_mail", e_mail);
    params.put("user_name", user_name);
    params.put("date_of_birth", date_of_birth);
    params.put("gender", gender);
    params.put("password", password);
    params.put("confirm_password", confirm_password);

}

这是reaponse

0 个答案:

没有答案