Source:
<code>private View.OnClickListener onClickActionSolver(final OnClickAction action) { return new View.OnClickListener() { @Override public void onClick(View v) { switch (action) { case SET_URL: ((LoginFragment) getActivity() .getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)) .setUrl(CustomFragmentDialog.this.mEditText.getText().toString().trim()); dismiss(); break; case DISMISS_URL_DIALOG: ((LoginFragment) getActivity() .getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)) .hideURLDialog(); dismiss(); break; case LOGIN: ((LoginFragment) getActivity() .getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)) .login(); dismiss(); break; case DISMISS: dismiss(); break; case LOGOUT: ((ACBaseActivity) getActivity()).logout(); dismiss(); break; case FINISH: getActivity().moveTaskToBack(true); android.os.Process.killProcess(android.os.Process.myPid()); System.exit(1); break; case INTERNET: getActivity().startActivity(new Intent(Settings.ACTION_SETTINGS)); dismiss(); break; case UNAUTHORIZED: ((ACBaseActivity) getActivity()).moveUnauthorizedUserToLoginScreen(); dismiss(); break; case END_VISIT: ((VisitDashboardActivity) getActivity()).mPresenter.endVisit(); dismiss(); break; case START_VISIT: doStartVisitAction(); dismiss(); break; case REGISTER_PATIENT: ((RegisterPatientActivity) getActivity()).mPresenter.registerPatient(); dismiss(); break; case CANCEL_REGISTERING: ((RegisterPatientActivity) getActivity()).mPresenter.finishRegisterActivity(); dismiss(); break; case DELETE_PATIENT: PatientDashboardActivity activity = (PatientDashboardActivity) getActivity(); <START> activity.mPresenter.deletePatient(activity.getId()); <END> dismiss(); activity.finish(); default: break; } } }; }</code><technical_language>call deletePatient :) apply changes</technical_language>

Target:
private View.OnClickListener onClickActionSolver(final OnClickAction action) { return new View.OnClickListener() { @Override public void onClick(View v) { switch (action) { case SET_URL: ((LoginFragment) getActivity() .getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)) .setUrl(CustomFragmentDialog.this.mEditText.getText().toString().trim()); dismiss(); break; case DISMISS_URL_DIALOG: ((LoginFragment) getActivity() .getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)) .hideURLDialog(); dismiss(); break; case LOGIN: ((LoginFragment) getActivity() .getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)) .login(); dismiss(); break; case DISMISS: dismiss(); break; case LOGOUT: ((ACBaseActivity) getActivity()).logout(); dismiss(); break; case FINISH: getActivity().moveTaskToBack(true); android.os.Process.killProcess(android.os.Process.myPid()); System.exit(1); break; case INTERNET: getActivity().startActivity(new Intent(Settings.ACTION_SETTINGS)); dismiss(); break; case UNAUTHORIZED: ((ACBaseActivity) getActivity()).moveUnauthorizedUserToLoginScreen(); dismiss(); break; case END_VISIT: ((VisitDashboardActivity) getActivity()).mPresenter.endVisit(); dismiss(); break; case START_VISIT: doStartVisitAction(); dismiss(); break; case REGISTER_PATIENT: ((RegisterPatientActivity) getActivity()).mPresenter.registerPatient(); dismiss(); break; case CANCEL_REGISTERING: ((RegisterPatientActivity) getActivity()).mPresenter.finishRegisterActivity(); dismiss(); break; case DELETE_PATIENT: PatientDashboardActivity activity = (PatientDashboardActivity) getActivity(); activity.mPresenter.deletePatient(); dismiss(); activity.finish(); default: break; } } }; }