3

I wanted to use Fragments for displaying different activities on one screen on a tablet, but realised that my tablet's API level is only 8 while Fragments require API level 11.

My question is thus, what was used before Fragments were introduced?

My assumption is that each activity was simply displayed on its own screen and one navigated from one activity to the next by means of the menu button, context menus and back button.

This is what I wanted to achieve using fragments: I write information about three "actions" to three different xml files. My idea was to display the three different xml files in three different fragments on the tablet's screen. The one file is information about a patient, the second file is x, y and z values received from an accelerometer and the third file is observations recorded by a therapist. I wanted to display the patient's info on the left (like a left bar), a graph showing the patient's test results on the right and below that, the therapist's observations.

Is there a way that I can display these three xml files' info on one screen of the tablet? Or am I doomed to the use of menu buttons and three different screens - one for displaying each xml file?

Comments will be appreciated.

marienke
  • 2,465
  • 4
  • 34
  • 66
  • You can use a single view and arrange different areas with layouts. That's what ViewGroups are about. They don't provide the modularity of fragments (own lifecycle, own events, etc) but for the purpose of displaying data is more than enough. – Mister Smith Sep 22 '11 at 13:19
  • 5
    You can use fragments even on Android 1.6, you have to download the "Android Compatibility package" - more info at http://android-developers.blogspot.com/2011/03/fragments-for-all.html – Daniel Novak Sep 22 '11 at 13:20
  • I am glad I could help you. You can mark my message as answer :-). Thanks. – Daniel Novak Sep 22 '11 at 13:24

2 Answers2

4

I am posting this as answer (removing the comment). You can use fragments even on Android 1.6, you have to download the "Android Compatibility package" - more info here and use it in your project (reference it as library). This way you don't need to build your own layout that would replicate fragments.

Daniel Novak
  • 2,746
  • 3
  • 28
  • 37
0

Yes, You can provide three different xml files and load them into a fragment.

You will need to create a layout file that contains 3 fragments, or one fragment and two frames.

If you need further implementation of this let me know and i will be glad to help you out.

coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118