I'm looking for some tips on the best way to handle fragments that trigger other fragments.
I am converting an application that I started to write using a more proactive approach, and since then I have begun to switch to using fragments. I have some fragments that were used to start a new action, and I want to move them to start other fragments in the same view as the current fragment.
For example, I have an Activity that has a WebView that uses WebViewClientto handle internal js-> java interactions. My WebViewClient may trigger other actions that I used to do:
i = new Intent(context, GoogleMapActivity.class);
startActivity(i);
This webview action may be full-screen or in a view using a side menu, but I want the webview to follow the layout. Therefore, if the menu is present, it should remain when new fragments are launched - I just put on. I don’t know the best approach to writing code that runs fragments.
So ... is there a way, within the Fragment, to essentially say a new fragment to load in the same space as the current fragment, or is there some kind of interaction with the Activity?
** EDIT **
Given that there are several different layouts that can be used, I don’t always know which identifier should aim to put this snippet, so I need to know if there is a way to do this without knowing the id (for example, in a method replace)