Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save felipeslongo/2195fed0f0ffebefa3f4fb112163f1bf to your computer and use it in GitHub Desktop.
Save felipeslongo/2195fed0f0ffebefa3f4fb112163f1bf to your computer and use it in GitHub Desktop.
Gets the selected/clicked item
using Android.Widget;
using Java.Lang;
namespace App.Droid.Extensions
{
/// <summary>
/// Extension method GetItem for <see cref="AdapterView.ItemClickEventArgs"/>
/// </summary>
/// <seealso cref="https://stackoverflow.com/questions/4819813/how-to-get-text-from-autocomplete-textview-android"/>
public static class AdapterView_ItemClickEventArgs_GetItem
{
/// <summary>
/// Gets the selected/clicked item
/// </summary>
/// <param name="this"></param>
/// <returns></returns>
public static Object GetItem(this AdapterView.ItemClickEventArgs @this)
=> @this.Parent.GetItemAtPosition(@this.Position);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment