Science, asked by BeLovedAadu, 3 months ago

What Is Fragment ?


Answer Pls​

Answers

Answered by ELECTROBRAINY
1

A Fragment represents a reusable portion of your app's UI. A fragment defines and manages its own layout, has its own lifecycle, and can handle its own input events. Fragments cannot live on their own--they must be hosted by an activity or another fragment

Answered by MananyaMuhury
1

\huge{\pink{\bold{\boxed{\ulcorner{\star\:Answer\: \star}\urcorner}}}}

A Fragment is a piece of an activity which enable more modular activity design. It will not be wrong if we say, a fragment is a kind of sub-activity.

Following are important points about fragment −

  • A fragment has its own layout and its own behaviour with its own life cycle callbacks.
  • You can add or remove fragments in an activity while the activity is running.
  • You can combine multiple fragments in a single activity to build a multi-pane UI.
  • A fragment can be used in multiple activities.
  • Fragment life cycle is closely related to the life cycle of its host activity which means when the activity is paused, all the fragments available in the activity will also be stopped.
  • A fragment can implement a behaviour that has no user interface component.
  • Fragments were added to the Android API in Honeycomb version of Android which API version 11.
Similar questions