Fragment.OnCreate(Bundle) Method
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.
Called to do initial creation of a fragment.
[Android.Runtime.Register("onCreate", "(Landroid/os/Bundle;)V", "GetOnCreate_Landroid_os_Bundle_Handler")]
public virtual void OnCreate(Android.OS.Bundle? savedInstanceState);
[<Android.Runtime.Register("onCreate", "(Landroid/os/Bundle;)V", "GetOnCreate_Landroid_os_Bundle_Handler")>]
abstract member OnCreate : Android.OS.Bundle -> unit
override this.OnCreate : Android.OS.Bundle -> unit
Parameters
- savedInstanceState
- Bundle
If the fragment is being re-created from a previous saved state, this is the state.
- Attributes
Remarks
Called for initial creation of a fragment, after attachment and before OnCreateView(LayoutInflater, ViewGroup, Bundle). It is not called again for an instance retained across activity recreation; see RetainInstance. The activity can still be in the process of being created, so its content view hierarchy might not be initialized. For work after the activity is created, see OnActivityCreated(Bundle).
On Android 5.0 through Android 6.0, child fragments are restored from savedInstanceState after this method returns. On Android 7.0 and later, this also applies to apps targeting API level 23 or lower; for apps targeting API level 24 or higher, the base implementation restores them during this method.
Android reference for android.app.Fragment.onCreate.
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.