By using Fragments, we can divide the activity into modules. Like activity fragments have their own lifecycle methods. You can add a fragment to activity in two ways.
1. Add Fragment using Fragment tag in XML file.
2. Add Fragment at runtime.
Like my Facebook page: / codeglympse
Subscribe My YouTube channel: / ticoontechnologies