Language

Fragment.Instantiate Method

Definition

Overloads

Name Description
Instantiate(Context, String)

Like #instantiate(Context, String, Bundle) but with a null argument Bundle.

Instantiate(Context, String, Bundle)

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

Instantiate(Context, String)

Like #instantiate(Context, String, Bundle) but with a null argument Bundle.

[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);
[<Android.Runtime.Register("instantiate", "(Landroid/content/Context;Ljava/lang/String;)Landroid/app/Fragment;", "")>]
static member Instantiate : Android.Content.Context * string -> Android.App.Fragment

Parameters

context
Context

Context

fname
String

String

Returns

A newly instantiated Fragment.

Attributes

Remarks

Like instantiate(Context,String,Bundle) but with a null argument Bundle.

Android reference for android.app.Fragment.instantiate.

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

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);
[<Android.Runtime.Register("instantiate", "(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;", "")>]
static member Instantiate : Android.Content.Context * string * Android.OS.Bundle -> Android.App.Fragment

Parameters

context
Context

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

fname
String

The class name of the fragment to instantiate.

args
Bundle

Bundle of arguments to supply to the fragment, which it can retrieve with #getArguments(). May be null.

Returns

Returns a new fragment instance.

Attributes

Remarks

Create a new instance of a Fragment with the given class name. This is the same as calling its empty constructor.

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

Android reference for android.app.Fragment.instantiate.

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