I need to get the selected/focused item's index of the VerticalGridFragment. I found the method to set the selected item in the documentation https://developer.android.com/reference/android/support/v17/leanback/app/VerticalGridFragment.html, i.e. setSelectedPosition(int position) which Sets the selected item position.
But I couldn't find any method in documentation which provides the selected Item or it's index.
Can someone please help me to find a work around to get the selected item of a VerticalGridFragment?
setOnItemViewSelectedListener
is fired when an item is selected. See docs here – Laidlawrow
oritem
is enough, you can get position of them from youradapter
or yourlist
objects ? I just give the idea, because I did not working with thisclass
before. You can look in the params ofonItemSelected
method from theinterface
– Laidlaw