AdapterView.IOnItemSelectedListener.OnItemSelected Method

Definition

Callback method to be invoked when an item in this view has been selected.

[Android.Runtime.Register("onItemSelected", "(Landroid/widget/AdapterView;Landroid/view/View;IJ)V", "GetOnItemSelected_Landroid_widget_AdapterView_Landroid_view_View_IJHandler:Android.Widget.AdapterView/IOnItemSelectedListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void OnItemSelected (Android.Widget.AdapterView? parent, Android.Views.View? view, int position, long id);
[<Android.Runtime.Register("onItemSelected", "(Landroid/widget/AdapterView;Landroid/view/View;IJ)V", "GetOnItemSelected_Landroid_widget_AdapterView_Landroid_view_View_IJHandler:Android.Widget.AdapterView/IOnItemSelectedListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member OnItemSelected : Android.Widget.AdapterView * Android.Views.View * int * int64 -> unit

Parameters

parent
AdapterView

The AdapterView where the selection happened

view
View

The view within the AdapterView that was clicked

position
Int32

The position of the view in the adapter

id
Int64

The row id of the item that is selected

Attributes

Remarks

Callback method to be invoked when an item in this view has been selected. This callback is invoked only when the newly selected position is different from the previously selected position or if there was no selected item.

Implementers can call getItemAtPosition(position) if they need to access the data associated with the selected item.

Java documentation for android.widget.AdapterView.OnItemSelectedListener.onItemSelected(android.widget.AdapterView<?>, android.view.View, int, long).

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