Fragment.Instantiate Fragment.Instantiate Method

Definition

Overloads

Instantiate(Context, String) Instantiate(Context, String)

M:Android.App.Fragment.Instantiate(Android.Content.Context,System.String,System.String)

Instantiate(Context, String, Bundle) Instantiate(Context, String, Bundle)

Create a new instance of a Fragment with the given class name.

Instantiate(Context, String) Instantiate(Context, String)

M:Android.App.Fragment.Instantiate(Android.Content.Context,System.String,System.String)

[Android.Runtime.Register("instantiate", "(Landroid/content/Context;Ljava/lang/String;)Landroid/app/Fragment;", "")]
public static Android.App.Fragment Instantiate (Android.Content.Context context, string fname);
static member Instantiate : Android.Content.Context * string -> Android.App.Fragment

Parameters

context
Context Context
fname
String String

Returns

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.

Instantiate(Context, String, Bundle) Instantiate(Context, String, Bundle)

Create a new instance of a Fragment with the given class name.

[Android.Runtime.Register("instantiate", "(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;", "")]
public static Android.App.Fragment Instantiate (Android.Content.Context context, string fname, Android.OS.Bundle args);
static member Instantiate : Android.Content.Context * string * Android.OS.Bundle -> Android.App.Fragment

Parameters

context
Context Context

The calling context being used to instantiate the fragment. This is currently just used to get its ClassLoader.

fname
String String

The class name of the fragment to instantiate.

args
Bundle Bundle

Bundle of arguments to supply to the fragment, which it can retrieve with Arguments. May be null.

Returns

Exceptions

If there is a failure in instantiating the given fragment class. This is a runtime exception; it is not normally expected to happen.

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.

Applies to