First I do not want merge the layouts because the main activity is to render a 3D scene, so there is no space to do that.
The reason I want to merge these two activities is when I call the setting activity, the main activity will go to sleep. When I am done with the settings and wake the main activity, the context is lost and it has to recreate the surface. Since the scene data is large, it wastes lots of time. So what I want is keep main activity running without onPause and finish the settings.
By the way, the setting is about setting values to distance and projected size. It needs some checkboxes and seekbars.
If you think PreferenceFragment is the way to solve this problem, please teach me how to use it in the menuoptions?
I am new in android. Thanks in advance.
Merging layouts does not preclude what you are trying to do. You can merge them by creating a higher level FrameLayout that has two children (layouts themselves). Your code then makes sure that only one of those two children are visible at a time.
For example…
Now in code, when you want the illusion of switching from one layout to another, you simply do something like:
(from within the UI thread).