Partager via


Fragment.OnAttach Method

Definition

Overloads

OnAttach(Activity)

This member is deprecated.

OnAttach(Context)

Called when a fragment is first attached to its context.

OnAttach(Activity)

This member is deprecated.

[Android.Runtime.Register("onAttach", "(Landroid/app/Activity;)V", "GetOnAttach_Landroid_app_Activity_Handler")]
public virtual void OnAttach (Android.App.Activity? activity);
[<Android.Runtime.Register("onAttach", "(Landroid/app/Activity;)V", "GetOnAttach_Landroid_app_Activity_Handler")>]
abstract member OnAttach : Android.App.Activity -> unit
override this.OnAttach : Android.App.Activity -> unit

Parameters

activity
Activity
Attributes

Remarks

This member is deprecated. Use #onAttach(Context) instead.

Java documentation for android.app.Fragment.onAttach(android.app.Activity).

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

OnAttach(Context)

Called when a fragment is first attached to its context.

[Android.Runtime.Register("onAttach", "(Landroid/content/Context;)V", "GetOnAttach_Landroid_content_Context_Handler", ApiSince=23)]
public virtual void OnAttach (Android.Content.Context? context);
[<Android.Runtime.Register("onAttach", "(Landroid/content/Context;)V", "GetOnAttach_Landroid_content_Context_Handler", ApiSince=23)>]
abstract member OnAttach : Android.Content.Context -> unit
override this.OnAttach : Android.Content.Context -> unit

Parameters

context
Context
Attributes

Remarks

Called when a fragment is first attached to its context. #onCreate(Bundle) will be called after this.

Java documentation for android.app.Fragment.onAttach(android.content.Context).

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