无法调用没有args的公共com.fundit.model.VerifyResponse()

时间:2017-08-04 05:30:38

标签: android json gson retrofit

当我点击登录按钮时,我正面临这种情况。它直接抛出异常。

注册活动的点击事件。

bt_signin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String emailID = ed_input_email.getText().toString().trim();
            String password = ed_input_password.getText().toString().trim();

            if (emailID.isEmpty()) {
                C.INSTANCE.showToast(getApplicationContext(), "Please enter email address");
            } else if (!C.INSTANCE.validEmail(emailID)) {
                C.INSTANCE.showToast(getApplicationContext(), "Please enter valid email address");
            } else if (password.isEmpty()) {
                C.INSTANCE.showToast(getApplicationContext(), "Please enter password");
            } else if (password.length() < 6) {
                C.INSTANCE.showToast(getApplicationContext(), "Please enter min. 6 char password");
            } else {
                String firebase_token = FirebaseInstanceId.getInstance().getToken();
                dialog.show();
                Call<VerifyResponse> responseCall = adminAPI.signInUser(emailID, password, firebase_token);
                Log.e("parameters" , "" + emailID +"-->"+ password+"-->" + firebase_token);
                responseCall.enqueue(new Callback<VerifyResponse>() {
                    @Override
                    public void onResponse(Call<VerifyResponse> call, Response<VerifyResponse> response) {
                        dialog.dismiss();
                        VerifyResponse verifyResponse = response.body();
                        if (verifyResponse != null) {
                            if (verifyResponse.isStatus()) {
                                String userData = new Gson().toJson(verifyResponse.getData().getUser());
                                String memberData = "";

                                Intent in;
                                in = new Intent(SignInActivity.this, HomeActivity.class);
                                in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                                switch (verifyResponse.getData().getUser().getRole_id()) {
                                    case C.ORGANIZATION:
                                        if (verifyResponse.getData().getMember().getOrganization() == null || verifyResponse.getData().getMember().getOrganization().getId() == null || verifyResponse.getData().getMember().getOrganization().getId().isEmpty()) {
                                            in = new Intent(getApplicationContext(), OrganizationProfileActivity.class);
                                            in.putExtra("firstTime", true);
                                        } else {
                                            memberData = new Gson().toJson(verifyResponse.getData().getMember().getOrganization());


                                        }
                                        break;
                                    case C.FUNDSPOT:
                                        if (verifyResponse.getData().getMember().getFundspot() == null || verifyResponse.getData().getMember().getFundspot().getId() == null || verifyResponse.getData().getMember().getFundspot().getId().isEmpty()) {
                                            in = new Intent(getApplicationContext(), FundSpotProfile.class);
                                            in.putExtra("firstTime",true);
                                        } else {
                                            memberData = new Gson().toJson(verifyResponse.getData().getMember().getFundspot());
                                        }
                                        break;
                                    case C.GENERAL_MEMBER:
                                        if (verifyResponse.getData().getMember() == null || verifyResponse.getData().getMember().getId() == null || verifyResponse.getData().getMember().getId().isEmpty()) {
                                            in = new Intent(getApplicationContext(), GeneralMemberProfileActivity.class);
                                            in.putExtra("firstTime",true);
                                        } else {
                                            memberData = new Gson().toJson(verifyResponse.getData().getMember());
                                        }
                                        break;
                                }

                                preference.setLoggedIn(true);
                                preference.setUserID(verifyResponse.getData().getUser().getId());
                                preference.setUserRoleID(verifyResponse.getData().getUser().getRole_id());
                                preference.setTokenHash(verifyResponse.getData().getUser().getTokenhash());
                                preference.setUserData(userData);
                                preference.setMemberData(memberData);

                                startActivity(in);

                            } else {
                                C.INSTANCE.showToast(getApplicationContext(), verifyResponse.getMessage());
                            }
                        } else {
                            C.INSTANCE.defaultError(getApplicationContext());
                        }
                    }

                    @Override
                    public void onFailure(Call<VerifyResponse> call, Throwable t) {
                        dialog.dismiss();
                        C.INSTANCE.errorToast(getApplicationContext(), t);
                    }
                });

            }
        }
    });

验证响应类:

public class VerifyResponse extends AppModel {

VerifyResponseData data = new VerifyResponseData();

public VerifyResponseData getData() {
    return data;
}

public class VerifyResponseData {
    User User = new User();
    Member Member = new Member();




    public com.fundit.model.Member getMember() {
        return Member;
    }

    public com.fundit.model.User getUser() {
        return User;
    }


  }
}

以下是JSON的回复:

{
"data": {
    "User": {
        "id": "2",
        "role_id": "2",
        "title": "Feeding America",
        "email_id": "app4@nividaweb.com",
        "first_name": "",
        "last_name": "",
        "password": "c11c58314b3b0647aa8fcdafdfebc294a414e175",
        "status": "1",
        "sort_order": "0",
        "otp": "530833",
        "anroid_device_id": "dshfdhdfjfgjfg",
        "ios_device_id": " ",
        "tokenhash": "bb5cde047f5c92ac3946c7c6c4e6160d",
        "reset_date": "0000-00-00 00:00:00",
        "is_verified": "1",
        "is_subscribe": "0",
        "profile_status": "1",
        "created": "2017-07-27 16:21:43",
        "modified": "2017-08-04 09:39:04"
    },
    "Member": {
        "id": "",
        "user_id": "",
        "first_name": "",
        "last_name": "",
        "state_id": "",
        "city_id": "",
        "location": "",
        "zip_code": "",
        "organization_id": "1",
        "fundspot_id": "",
        "contact_info": "",
        "image": "",
        "status": "",
        "created": "",
        "modified": "",
        "State": {
            "id": "",
            "name": ""
        },
        "City": {
            "id": "",
            "name": ""
        },
        "Organization": {
            "id": "1",
            "user_id": "2",
            "title": "Feeding America",
            "state_id": "7",
            "city_id": "5",
            "location": "nwjwnwt",
            "zip_code": "45949",
            "type_id": "3",
            "sub_type_id": "2",
            "description": "bwrweh",
            "contact_info": "E1 a qeq",
            "image": "/catalog/15017840831.png",
            "created": "2017-07-27 16:24:25",
            "modified": "2017-08-03 23:44:43",
            "State": {
                "id": "7",
                "name": "London"
            },
            "City": {
                "id": "5",
                "name": "London City"
            },
            "Type": {
                "id": "3",
                "name": "College/University"
            },
            "SubType": {
                "id": "2",
                "name": "School"
            }
        }
    }
},
"status": true,
"message": "You've successfully logged in !"
 }

请帮助我解决这个问题,因为我无法在过去几天内解决此错误。面临的例外是无法调用没有args的公共com.fundit.model.VerifyResponse()

Screenshot of error log

0 个答案:

没有答案