Fragment.OnAttach 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.
Overloads
| Name | Description |
|---|---|
| OnAttach(Activity) |
This method was deprecated in API level 23. |
| OnAttach(Context) |
Called when a fragment is first attached to its context. |
OnAttach(Activity)
This method was deprecated in API level 23.
[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
Activity
- Attributes
Remarks
This method was deprecated in API level 23. Use onAttach(Context) instead.
If you override this method you must call through to the superclass implementation.
Android reference for android.app.Fragment.onAttach.
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
Context
- Attributes
Remarks
Called when a fragment is first attached to its context. onCreate(Bundle) will be called after this. If you override this method you must call through to the superclass implementation.
Android reference for android.app.Fragment.onAttach.
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.