In the presenter I appeal to the database and in case of a successful response, I start a new activation from the view.
code :
mRepository.setUrl(resources.getString(R.string.url_server) + resources.getString(R.string.url_authorization)); mRepository.setJson(getJsonQuery()); mRepository.setRequest("post"); mRepository.loadResponse(new ModelDB.CompleteCallback() { @Override public void onComplete(String response) { mView.hideProgressDialog(); if (response.equals("successful")) { //авторизация пройдена успешна, перехожу к карте Intent intent = new Intent(mView.getContextView(), MapView.class); intent.putExtra("main_user", mView.getUsername()); intent.putExtra("tittle_user", mView.getUsername()); mView.startActivity(intent); } else { mView.showToast(response); } code from View
@Override public void startActivity(Intent intent) { startActivity(intent); } mView and mRepository MVP application components.
Runtime error
09-26 14: 41: 11.336 22352-22352 / popovvad.findme E / AndroidRuntime: FATAL EXCEPTION: main Process: popovvad.findme, PID: 22352 java.lang.StackOflowError: stack size 8MB at popovvadfindme.authorization.AuthorizationView. startActivity (AuthorizationView.java:96)
In this case, the showToast method of the view works, there were no problems with the types. Tell me what I'm doing wrong?
PS StackOverflowError
Activitymethod so that it always calls itself, so the stack ends. Either call the ancestor method viasuper, or rename the method in the interface so that you do not have to override it. - zRrr pm