Home | History | Annotate | Download | only in app

Lines Matching defs:Fragment

69     Fragment mInstance;
71 public FragmentState(Fragment frag) {
96 public Fragment instantiate(FragmentHostCallback host, Fragment parent) {
106 mInstance = Fragment.instantiate(context, mClassName, mArguments);
122 "Instantiated fragment " + mInstance);
157 * A Fragment is a piece of an application's user interface or behavior
161 * {@link Fragment#getFragmentManager() Fragment.getFragmentManager()}.
163 * <p>The Fragment class can be used many ways to achieve a wide variety of
165 * that is running within a larger {@link Activity}. A Fragment is closely
167 * Fragment defines its own lifecycle, that lifecycle is dependent on its
171 * <p>All subclasses of Fragment must include a public no-argument constructor.
172 * The framework will often re-instantiate a fragment class when needed,
195 * While the Fragment API was introduced in
205 * <p>Though a Fragment's lifecycle is tied to its owning activity, it has
210 * <p>The core series of lifecycle methods that are called to bring a fragment
214 * <li> {@link #onAttach} called once the fragment is associated with its activity.
215 * <li> {@link #onCreate} called to do initial creation of the fragment.
217 * with the fragment.
218 * <li> {@link #onActivityCreated} tells the fragment that its activity has
220 * <li> {@link #onViewStateRestored} tells the fragment that all of the saved
222 * <li> {@link #onStart} makes the fragment visible to the user (based on its
224 * <li> {@link #onResume} makes the fragment begin interacting with the user
228 * <p>As a fragment is no longer being used, it goes through a reverse
232 * <li> {@link #onPause} fragment is no longer interacting with the user either
233 * because its activity is being paused or a fragment operation is modifying it
235 * <li> {@link #onStop} fragment is no longer visible to the user either
236 * because its activity is being stopped or a fragment operation is modifying it
238 * <li> {@link #onDestroyView} allows the fragment to clean up resources
240 * <li> {@link #onDestroy} called to do final cleanup of the fragment's state.
241 * <li> {@link #onDetach} called immediately prior to the fragment no longer
254 * <p>An activity's layout XML can include <code>&lt;fragment&gt;</code> tags
255 * to embed fragment instances inside of the layout. For example, here is
256 * a simple layout that embeds one fragment:</p>
265 * <p>The titles fragment, showing a list of titles, is fairly simple, relying
268 * create and display a new fragment to show the details in-place (more about
274 * <p>The details fragment showing the contents of a selected item just
282 * container in the current activity, so the titles fragment's click code will
283 * launch a new activity to display the details fragment:</p>
295 * fragment will now embed the details fragment inside of this activity, and the
303 * instance. However, any that are no longer associated with a &lt;fragment&gt;
306 * how you can determine if a fragment placed in a container is no longer
310 * <p>The attributes of the &lt;fragment&gt; tag are used to control the
311 * LayoutParams provided when attaching the fragment's view to the parent
312 * container. They can also be parsed by the fragment in {@link #onInflate}
315 * <p>The fragment being instantiated must have some kind of unique identifier
323 * <li><code>android:tag</code> can be used in &lt;fragment&gt; to provide
324 * a specific tag name for the fragment.
325 * <li><code>android:id</code> can be used in &lt;fragment&gt; to provide
326 * a specific identifier for the fragment.
337 * <p>For example, consider this simple fragment that is instantiated with
341 * fragment}
343 * <p>A function that creates a new instance of the fragment, replacing
344 * whatever current fragment instance is being shown and pushing that change
354 public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListener {
370 // Non-null if the fragment's view hierarchy is currently animating away,
383 // Index into active fragment array.
386 // Internal unique name for this fragment;
392 // Target fragment.
393 Fragment mTarget;
395 // For use when retaining a fragment: this is the index of the last mTarget.
401 // True if the fragment is in the list of added fragments.
404 // If set this fragment is being removed from its activity.
407 // True if the fragment is in the resumed state.
410 // Set to true if this fragment was instantiated from a layout file.
416 // True if this fragment has been restored from previously saved state.
419 // Number of active back stack entries this fragment is in.
422 // The fragment manager we are associated with. Set as soon as the
423 // fragment is used in a transaction; cleared after it has been removed
427 // Activity this fragment is attached to.
430 // Private fragment manager for child fragments inside of this one.
433 // If this Fragment is contained in another Fragment, this is that container.
434 Fragment mParentFragment;
436 // The optional identifier for this fragment -- either the container ID if it
441 // When a fragment is being dynamically added to the view hierarchy, this
445 // The optional named tag for this fragment -- usually used to find
449 // Set to true when the app has requested that this fragment be hidden
453 // Set to true when the app has requested that this fragment be detached.
456 // If set this fragment would like its instance retained across
460 // If set this fragment is being retained across the current config change.
463 // If set this fragment has menu items to contribute.
466 // Set to true to allow the fragment's menu to be shown.
475 // The parent container of the fragment after dynamically added to UI.
478 // The View generated for this fragment.
481 // Whether this fragment should defer starting until after other fragments
485 // Hint provided by the app that this fragment is currently visible to the user.
505 * State information that has been retrieved from a fragment instance
506 * through {@link FragmentManager#saveFragmentInstanceState(Fragment)
550 * Thrown by {@link Fragment#instantiate(Context, String, Bundle)} when
560 * Default constructor. <strong>Every</strong> fragment must have an
564 * will not be called when the fragment is re-instantiated; instead,
566 * and later retrieved by the Fragment with {@link #getArguments}.
569 * first place application code can run where the fragment is ready to
570 * be used is in {@link #onAttach(Activity)}, the point where the fragment
574 * the fragment is attached to its activity.
576 public Fragment() {
583 public static Fragment instantiate(Context context, String fname) {
588 * Create a new instance of a Fragment with the given class name. This is
591 * @param context The calling context being used to instantiate the fragment.
593 * @param fname The class name of the fragment to instantiate.
594 * @param args Bundle of arguments to supply to the fragment, which it
596 * @return Returns a new fragment instance.
598 * the given fragment class. This is a runtime exception; it is not
601 public static Fragment instantiate(Context context, String fname, @Nullable Bundle args) {
607 if (!Fragment.class.isAssignableFrom(clazz)) {
609 + " that is not a Fragment", new ClassCastException());
613 Fragment f = (Fragment)clazz.newInstance();
620 throw new InstantiationException("Unable to instantiate fragment " + fname
624 throw new InstantiationException("Unable to instantiate fragment " + fname
628 throw new InstantiationException("Unable to instantiate fragment " + fname
642 throw new SuperNotCalledException("Fragment " + this
647 final void setIndex(int index, Fragment parent) {
652 mWho = "android:fragment:" + mIndex;
695 * Return the identifier this fragment is known by. This is either
697 * supplied when adding the fragment.
704 * Get the tag name of the fragment, if specified.
711 * Supply the construction arguments for this fragment. This can only
712 * be called before the fragment has been attached to its activity; that
713 * is, you should call it immediately after constructing the fragment. The
714 * arguments supplied here will be retained across fragment destroy and
719 throw new IllegalStateException("Fragment already active");
732 * Set the initial saved state that this Fragment should restore itself
734 * {@link FragmentManager#saveFragmentInstanceState(Fragment)
737 * @param state The state the fragment should be restored from.
741 throw new IllegalStateException("Fragment already active");
748 * Optional target for this fragment. This may be used, for example,
749 * if this fragment is being started by another, and when done wants to
754 * @param fragment The fragment that is the target of this one.
758 public void setTargetFragment(Fragment fragment, int requestCode) {
759 mTarget = fragment;
764 * Return the target fragment set by {@link #setTargetFragment}.
766 final public Fragment getTargetFragment() {
778 * Return the {@link Context} this fragment is currently associated with.
785 * Return the Activity this fragment is currently associated with.
792 * Return the host object of this fragment. May return {@code null} if the fragment
805 throw new IllegalStateException("Fragment " + this + " not attached to Activity");
845 * with this fragment's activity. Note that this will be non-null slightly
846 * before {@link #getActivity()}, during the time from when the fragment is
850 * <p>If this Fragment is a child of another Fragment, the FragmentManager
859 * inside of this Fragment.
878 * Returns the parent Fragment containing this Fragment. If this Fragment
881 final public Fragment getParentFragment() {
886 * Return true if the fragment is currently added to its activity.
893 * Return true if the fragment has been explicitly detached from the UI.
894 * That is, {@link FragmentTransaction#detach(Fragment)
895 * FragmentTransaction.detach(Fragment)} has been used on it.
902 * Return true if this fragment is currently being removed from its
912 * hierarchy via the &lt;fragment&gt; tag. This will always be true when
913 * fragments are created through the &lt;fragment&gt; tag, <em>except</em>
914 * in the case where an old fragment is restored from a previous state and
922 * Return true if the fragment is in the resumed state. This is true
930 * Return true if the fragment is currently visible to the user. This means
940 * Return true if the fragment has been hidden. By default fragments
943 * to other states -- that is, to be visible to the user, a fragment
952 * the fragment has changed. Fragments start out not hidden; this will
953 * be called whenever the fragment changes state from that.
954 * @param hidden True if the fragment is now hidden, false if it is not
961 * Control whether a fragment instance is retained across Activity
963 * be used with fragments not in the back stack. If set, the fragment
967 * will be, because the fragment is being detached from its current activity).
968 * <li> {@link #onCreate(Bundle)} will not be called since the fragment
987 * Report that this fragment would like to participate in populating
991 * @param hasMenu If true, the fragment has menu items to contribute.
1003 * Set a hint for whether this fragment's menu should be visible. This
1004 * is useful if you know that a fragment has been placed in your view
1008 * @param menuVisible The default is true, meaning the fragment's menu will
1021 * Set a hint to the system about whether this fragment's UI is currently visible
1022 * to the user. This hint defaults to true and is persistent across fragment instance
1025 * <p>An app may set this to false to indicate that the fragment's UI is
1027 * This may be used by the system to prioritize operations such as fragment lifecycle updates
1030 * @param isVisibleToUser true if this fragment's UI is currently visible to the user (default),
1042 * @return The current value of the user-visible hint on this fragment.
1050 * Return the LoaderManager for this fragment, creating it if needed.
1057 throw new IllegalStateException("Fragment " + this + " not attached to Activity");
1065 * Call {@link Activity#startActivity(Intent)} from the fragment's
1075 * Call {@link Activity#startActivity(Intent, Bundle)} from the fragment's
1085 throw new IllegalStateException("Fragment " + this + " not attached to Activity");
1097 * Call {@link Activity#startActivityForResult(Intent, int)} from the fragment's
1105 * Call {@link Activity#startActivityForResult(Intent, int, Bundle)} from the fragment's
1110 throw new IllegalStateException("Fragment " + this + " not attached to Activity");
1208 throw new IllegalStateException("Fragment " + this + " not attached to Activity");
1286 * Called when a fragment is being created as part of a view layout
1288 * may be called immediately after the fragment is created from a <fragment>
1289 * tag in a layout file. Note this is <em>before</em> the fragment's
1293 * <p>This is called every time the fragment is inflated, even if it is
1298 * <p>Here is a typical implementation of a fragment that can take parameters
1302 * fragment}
1309 * <p>The fragment can then be declared within its activity's content layout
1314 * <p>This fragment can also be created dynamically from arguments given
1321 * @param context The Context that is inflating this fragment.
1322 * @param attrs The attributes at the tag where the fragment is
1324 * @param savedInstanceState If the fragment is being re-created from
1332 com.android.internal.R.styleable.Fragment);
1372 * Called when a fragment is first attached to its context.
1393 * Called when a fragment loads an animation.
1400 * Called to do initial creation of a fragment. This is called after
1404 * <p>Note that this can be called while the fragment's activity is
1410 * @param savedInstanceState If the fragment is being re-created from
1418 * Called to have the fragment instantiate its user interface view.
1427 * any views in the fragment,
1428 * @param container If non-null, this is the parent view that the fragment's
1429 * UI should be attached to. The fragment should not add the view itself,
1431 * @param savedInstanceState If non-null, this fragment is being re-constructed
1434 * @return Return the View for the fragment's UI, or null.
1446 * they know their view hierarchy has been completely created. The fragment's
1449 * @param savedInstanceState If non-null, this fragment is being re-constructed
1456 * Get the root view for the fragment's layout (the one returned by {@link #onCreateView}),
1459 * @return The fragment's root view, or null if it has no layout.
1467 * Called when the fragment's activity has been created and this
1468 * fragment's view hierarchy instantiated. It can be used to do final
1472 * as this callback tells the fragment when it is fully associated with
1476 * @param savedInstanceState If the fragment is being re-created from
1485 * of the fragment. This can be used to do initialization based on saved
1491 * @param savedInstanceState If the fragment is being re-created from
1499 * Called when the Fragment is visible to the user. This is generally
1519 * Called when the fragment is visible to the user and actively running.
1529 * Called to ask the fragment to save its current dynamic state, so it
1531 * restarted. If a new instance of the fragment later needs to be
1541 * where a fragment may be mostly torn down (such as when placed on the
1555 * Called when the Fragment is no longer resumed. This is generally
1564 * Called when the Fragment is no longer started. This is generally
1582 * been detached from the fragment. The next time the fragment needs
1594 * Called when the fragment is no longer in use. This is called
1611 * Called by the fragment manager once this fragment has been removed,
1641 * Called when the fragment is no longer attached to its activity. This
1682 * Called when this fragment's option menu items are no longer being
1684 * the menu needed to be rebuilt, but this fragment's items were not
1747 * {@link OnCreateContextMenuListener} on the view to this fragment, so
1792 * is called when this Fragment is attached or detached when not popping the back stack.
1794 * @param callback Used to manipulate the shared element transitions on this Fragment
1813 * is called when this Fragment is attached or detached when popping the back stack.
1815 * @param callback Used to manipulate the shared element transitions on this Fragment
1862 * Sets the Transition that will be used to move Views out of the scene when the Fragment is
1871 * @param transition The Transition to use to move Views out of the Scene when the Fragment
1880 * Returns the Transition that will be used to move Views out of the scene when the Fragment is
1888 * @return the Transition to use to move Views out of the Scene when the Fragment
1899 * fragment is removed, hidden, or detached when not popping the back stack.
1906 * @param transition The Transition to use to move Views out of the Scene when the Fragment
1916 * fragment is removed, hidden, or detached when not popping the back stack.
1923 * @return the Transition to use to move Views out of the Scene when the Fragment
1996 * pop of the back stack. This Transition acts in the leaving Fragment.
2013 Fragment.
2164 Fragment findFragmentByWho(String who) {
2181 throw new IllegalStateException("Fragment does not have a view");
2200 throw new SuperNotCalledException("Fragment " + this
2230 throw new SuperNotCalledException("Fragment " + this
2246 throw new SuperNotCalledException("Fragment " + this
2265 throw new SuperNotCalledException("Fragment " + this
2381 throw new SuperNotCalledException("Fragment " + this
2393 throw new SuperNotCalledException("Fragment " + this
2420 throw new SuperNotCalledException("Fragment " + this
2435 throw new SuperNotCalledException("Fragment " + this