I have a ListActivity
that implements onListItemClick()
and calls a doSomething()
function of the class. The latter contains l.setSelection(position)
where l
is the ListView
object.
Now there is a onClickListener()
listening for a button click that perfoms some actions and that too calls doSomething()
.
In the first case, the selected item get positioned appropriately, but in the latter, nothing happens.
Any clues about this strange behaviour and how I might make it work?
myList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
and thesetItemChecked
worked for me, it moved the selection indicator to the item I passed in (unselecting the previous one). – Cherokee