有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

安卓工作室组织。json。JSONException:类型为java。无法将lang.String转换为JSONObject

我想用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);

}

这是回复


共 (0) 个答案