I am writing an editor (of sorts) which I want to be able to have multiple windows open at the same time, and I want to be able to navigate between windows as can be done in the default browser (Internet) application. See picture: http://i.imgur.com/LM6Nz.png for clarification.
My question is how to implement these windows; Do I want each window to be an own (Editor) Activity, should I use Fragments (I am mainly designing for API 10, and Fragments arrived in API 11, but I read somewhere this should be fine). Or do I simply hack together some different Views in a ViewGroup?
If I use Fragments, do I place them in a ViewGroup?
I developed a similar app with four tabs (and more can be added if desired). One for a webview, one for a facebook app and two others. I started them as one single activity and put all the views in one single xml file (under different tabs). Worked pretty fine for me.
Are you encountering any problems or just want a better way to do this thing?
Fragments were meant for scenarios similar to the one you are facing. Think about it, you need to show them all in the same activity so an Activity won't be a proper option. At the same time you'll want for all of them to work independently and to manage their own lifecycle internally. You can support fragments since API no. 4, by using the compatibility library. (http://developer.android.com/tools/extras/support-library.html)
Ultimately you can group them as you like/need. That's one of the other strengths of fragments. From the most basic container (FrameLayout) to the richest galleries such as ViewPager.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With