Hi everyone, I have a question about Android, but not related to Kotlin (sorry).
1. Is it a good practice to use multiple fragments on one activity?
2. Is where any rules, best practices when to choose layout inside fragment, and when to move it to separate fragment?
Thanks for your answer.
Second question is about selecting between fragment and layout.
For example, I have fragment inside activity.
And some group of controls what need to be placed on same screen, united by function they do. Group of buttons, button + text field or something like this.
So, should I place them inside same fragment but separate in nested layout or don’t separate at all. Or I should move them to separate fragment and put two fragments on one screen? Is there any rules, best practices to make those decisions?
Nikolai
08/01/2019, 4:47 PM
Sorry, if I am not clear
n
Nir Golan
08/01/2019, 6:41 PM
If there are some same UI elements in all the fragments you can place them inside the activity.
We have checkout process in our app. One activity and several fragments. The button to continue is on the activity and it's changed based on the fragments the client is on
a
Aslam Hossin
08/02/2019, 3:12 AM
@Nikolai, Then you can remove View from your parent layout based on your logic and can add new View. If number off View is more to manage in this way then you can use ViewPager2