When you want to design your activity in a modular way, you can use fragmented fragment. We can say that fragment is a sub-activity.
Here are some important features of fragment:
1.fragment has its own layout, its own behavior, and its own life cycle.
2. When an activity is running, you can add or remove fragment.
3.fragment can be used in multiple activities.
The life cycle of 4.fragment is related to its host activity
5.fragment is added on API 11.
You can create a fragment by Extens Fragement class, and then you can declare fragment by adding the <fragment> element to an activity's layout file.
For fragment, it's important to know that we have a limit because we can only show one activity on the screen at a point in time, so I don't want to split the screen and then separate control them separately. But, we can combine multiple fragment on one activity and have their own layout, event handling, and complete life cycle.
Here's a typical illustration of two different ways to build a UI:
The rest of the next time to write it.
Android's Fragment