OSDN Git Service

Clarify Fragment construtor javadoc.
authorAurimas Liutikas <aurimas@google.com>
Tue, 14 Jun 2016 23:50:07 +0000 (16:50 -0700)
committerAurimas Liutikas <aurimas@google.com>
Tue, 14 Jun 2016 23:50:07 +0000 (16:50 -0700)
Bug:
https://code.google.com/p/android/issues/detail?id=170497
https://code.google.com/p/android/issues/detail?id=55991

Change-Id: If2309f441bb947f32da60ba7926cc6796e472fdf

core/java/android/app/Fragment.java

index 3494079..c70d45d 100644 (file)
@@ -574,13 +574,11 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
      * arguments can be supplied by the caller with {@link #setArguments}
      * and later retrieved by the Fragment with {@link #getArguments}.
      *
-     * <p>Applications should generally not implement a constructor.  The
-     * first place application code can run where the fragment is ready to
-     * be used is in {@link #onAttach(Activity)}, the point where the fragment
-     * is actually associated with its activity.  Some applications may also
-     * want to implement {@link #onInflate} to retrieve attributes from a
-     * layout resource, though should take care here because this happens for
-     * the fragment is attached to its activity.
+     * <p>Applications should generally not implement a constructor. Prefer
+     * {@link #onAttach(Context)} instead. It is the first place application code can run where
+     * the fragment is ready to be used - the point where the fragment is actually associated with
+     * its context. Some applications may also want to implement {@link #onInflate} to retrieve
+     * attributes from a layout resource, although note this happens when the fragment is attached.
      */
     public Fragment() {
     }