Is Fragment an Activity? and what is difference between fragment and FragmentActivity?
Asked
Active
Viewed 6,314 times
3 Answers
8
A Fragment is not an Activity. Fragments are hosted inside a FragmentActivity.
Check PJL's answer for more information.

Leon van Noord
- 868
- 1
- 7
- 24
0
In Android an Activity
can contain several Fragments
inside. Each Fragment can be considered a View Controller. Android allows you include child Fragment inside parent Fragment.
When Activity
is running, you can manipulate each Fragment
independently, such as add or remove them.
Developer's documentation:
A
fragment
must always be hosted in an activity and the fragment's lifecycle is directly affected by the host activity's lifecycle. For example, when the activity is paused, so are all fragments in it, and when the activity is destroyed, so are all fragments.

Andy Jazz
- 49,178
- 17
- 136
- 220