hi,
I integrate this architecture in my code, but I have found that it is not a good way to keep the reference of a activity like the following:
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof BaseActivity) {
BaseActivity activity = (BaseActivity) context;
mActivity = activity;
activity.onFragmentAttached();
}
}
Because the reference may be finished, destroyed, which is not valid for use. In fact, I have to check whether the activity is valid all the time. which I really feel bothered. Can we find a better way? Thank you very much.