The fact is that in every Activity there is a bodyOnResume() method that does a check.
public void bodyOnResume(){ checkForResponseVacancy(model.getId()); } And I call the bodyOnResume() method inside a dialogFragment after dismiss()
mOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); ((MainBodyActivity) getActivity()).bodyOnResume(); } }); This option works, but only for one MainBodyActivity , and I need to have a universal method for getting the name of the Activity that caused this dialog box.
You can try this:
if (this.getClass().getSimpleName().equals(VacancyBodyActivity.class.toString())) { ((VacancyBodyActivity) getActivity()).bodyOnResume(); } else if(this.getClass().getSimpleName().equals(AnotherActivity.class.toString())) ((AnotherActivity) getActivity()).bodyOnResume(); } ...... // и дальше для 100500 Activity I tried another option:
((AppCompatActivity) getActivity()).bodyOnResume(); But here the bodyOnResume() method does not see
Question : Are there any options, how to solve this problem?