What is the relationship between activity and fragment?

Ngô Quốc Huy

New member
What is the relationship between activity and fragment?
Answer
Fragment must be hosted by an activity and they can not execute independently. Fragment they have their own life cycle which mean they can start an app. for example: they have onCreate() method so the fragment can add their own menu items to host an activity menu.
 

Tìm kiếm

Back
Top