Other than using listeners, is there any way by which i can get index of an item in the list?
A:
Perhaps you mean ListView, in which case you may want getCheckedItemPosition
.
Matthew Flaschen
2010-10-07 03:29:22
Suppose I have a list having 10 items. When the list control/cursor is in 5th position, I need to get index 5, that too, without using OnItemSelectedListener. is it possible?
mdv
2010-10-07 03:41:38
+1
A:
If you are using 'getCheckedItemPosition' dont forget to set the choice mode to single in order to ensure only one item can be selected at a time. ie via
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
And to answer your question : yes , this can be used without a listener.
x1886x
2010-10-07 04:59:46