Fragment Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Fragment() |
Default constructor. |
Fragment(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Fragment()
Default constructor.
[Android.Runtime.Register(".ctor", "()V", "")]
public Fragment ();
- Attributes
Remarks
Default constructor. <strong>Every</strong> fragment must have an empty constructor, so it can be instantiated when restoring its activity's state. It is strongly recommended that subclasses do not have other constructors with parameters, since these constructors will not be called when the fragment is re-instantiated; instead, arguments can be supplied by the caller with #setArguments
and later retrieved by the Fragment with #getArguments
.
Applications should generally not implement a constructor. Prefer #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 #onInflate
to retrieve attributes from a layout resource, although note this happens when the fragment is attached.
Java documentation for android.app.Fragment.Fragment()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
Fragment(IntPtr, JniHandleOwnership)
A constructor used when creating managed representations of JNI objects; called by the runtime.
protected Fragment (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.App.Fragment : nativeint * Android.Runtime.JniHandleOwnership -> Android.App.Fragment
Parameters
- transfer
- JniHandleOwnership
A JniHandleOwnershipindicating how to handle javaReference
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.