0

I have a recording app which I recently convert it on tabs layout. One tab is called Recorder and the other one is called Player. Both are integrated in a SherlockFragmentActivity. Each tab represent a fragment with its own layout. The Player fragment has a list with recordings and clicking on an item will open another activity which plays the recording.

All I want is to get rid of that activity and to incorporate a player control directly in the Player fragment. Basically I want to add another fragment in the player fragment (at bottom of the recordings list I want to add a fragment with play, pause, stop, etc buttons). Is it a good practice to add a fragment into another one? If not, how should I add that player control panel?(without simply adding the buttons in the same layout as the list is).

2
  • Please don't prefix your questions titles with keywords like Android, Blackberry, iOs, the tags at the bottom are enough.
    – user
    May 24, 2013 at 14:00
  • Thanks for pointing this out, I didn't know. May 24, 2013 at 14:15

1 Answer 1

0

Is it a good practice to add a fragment into another one?

Sure if you decide that you want this, that's why nested fragments have been introduced on the platform. Based on your situation and due to the use of fragments as tabs I wouldn't use a nested fragment, I would just insert the controls in the fragment's layout and change the visibility for that part as the user plays/stops stuff.

2
  • Thanks, I will add a layout with those controls and assigning to it a separate class (maybe I will use the <include> layout option) May 24, 2013 at 14:20
  • 1
    @AlexandruCircus The include tag is an option, you could also use a ViewStub to delay the loading of those views until the user actually request them.
    – user
    May 24, 2013 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.