Computer Science, asked by sweetyng6741, 1 year ago

If a fragment contains an interface and an activity implements that interface then would that fragment called automatically

Answers

Answered by choudhary21
0

Explanation:

Fragment is a part of an activity, which contributes its own UI to that activity.

Fragment can be thought like a sub activity, whereas the complete screen with which user interacts is called as activity.

An activity can contain multiple fragments. Fragment are part of an activity.

Answered by Anonymous
2

Answer:

To allow a Fragment to communicate up to its Activity, you can define an interface in the Fragment class and implement it within the Activity. The Fragment captures the interface implementation during its onAttach() lifecycle method and can then call the Interface methods in order to communicate with the Activity.

Thnku!❤️

Similar questions