Skip to content Skip to sidebar Skip to footer

Loading Activity In Fragment Code

Can we load an activity (specifically in onCreateView) in fragment ? Instead of creating view by inflater, can we launch activity so it's events gets called ? For e.g. Instead of

Solution 1:

Unfortunately this is not possible. You must create a Fragment Activity that will be used to refer to any fragment you create.

This is a good place to start:

Fragments Examples

Solution 2:

It's not possible you cannot add Activity inside a fragment. Fragment is part of UI component of Activity.

Refer below link

Docs for fragment in Android

Post a Comment for "Loading Activity In Fragment Code"