Please help to understand Activity & Fragment navigation strategy.
For some reasons (need to change app theme / style) I haven't found better way then make few activities with few fragments inside each of them.
So lets assume we have Activities A1 and A2 and fragments connected to them: A1 – F1, F2 and A2 - F3 , F4.
Right now I need to do such queue of openings :
Starting with A1:F1-F2. Then from F2 I would like to start A2 and open F3 on it. Then move to F4. On F4 I would like to make some preferences changes and return back to A1 with remained opened F2.
But F2 should be refreshed to apply preferences changes made by F4.
I've found information about startActivityForResult(...)
and processing onActivityResult(...)
after it. But onActivityResult(...)
is not called at all for my A1. What will be the best for – call onCreateView(...)
in F2 when returns back from F4(A2).
So what is the common strategy to work with multiple activities and fragments and how to return results back/force refresh?
Already tried this but without success onActivityResult is not being called in Fragment
EDIT1: code snippets - activity result processing
F2 - fragment:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != Activity.RESULT_OK)
return;
makeToast(this.getActivity(), "REPORT OK");
}
A1 - activity:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
How I start A2 from F2:
Intent intent = new Intent(getActivity(), DesignerActivity.class);
startActivityForResult(intent, InputAddressFragment.REQ_CODE_UPADETE_UI);