Apps Fragments Displaying other Fragments


So I am Very new to the entire android thing, and I'm currently working on developing a unique app. In doing so I am trying to find the best way to implement it and wanting to know if my topic is in fact possible. So for a bit more specifics this is what I am wanting to do but unsure if I can:

Consider an Activity with 2 Fragments we will call them Top_1 & Bottom_1, now Bottom_1 will remain on the bottom half of the screen at all times first appearing with Top_1. Through Button/Spinner Listener in Bottom_1 I want to be able to display different Fragments, such as Top_2, Top_3, Top_4 etc. all the while keeping Bottom_1 intact.

At this given moment I am just looking to see if this is possible to do, as I have created a two Fragment activity, and from what I learned I'm having difficulty grasping in how I would call to the other Fragments and have them replace the top.

Thanks for your consideration.

Deleted User

Yes indeed. It's why fragments were introduced - to make it possible to create modular, composite screens with dynamic content. It also allows great code reuse, and promotes good software architecture. Fragments also have a lifecycle very similar to Activities, and you can add them to the back stack - so the back button works, if you want that behaviour.
I think all this fits in with what you want to achieve. In fact I'm doing something very similar myself right at the moment, creating a screen which has distinct parts, which can vary, depending on the user input. It's possible to replace a container element with a different Fragment, dynamically. There are lots of code examples of how to do this.
Fragments are the way to go!


Thread starter
Thanks for the Reply Much appreciated, I might need some help getting it fully working, but let me work on the code some and see what I can make happen first, then If I need help in quirking the code I'll be back :)