Condividi tramite


Fragment.Instantiate Method

Definition

Overloads

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
fname
String

Returns

Attributes

Remarks

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

Java documentation for android.app.Fragment.instantiate(android.content.Context, java.lang.String).

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

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

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

Java documentation for android.app.Fragment.instantiate(android.content.Context, java.lang.String, android.os.Bundle).

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