Q:

Set activated item in ListView programmatically

I have a simple ListView with some items that have setChoiceMode set to ListView.CHOICE_MODE_SINGLE, which means when I touch an item, it is highlighted. This way the user can see what menu choice (the ListView is a menu) was chosen:
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

However, I want to change that selection from code (not by touching). I tried this:
listView.setSelection(0);

but it seems to have no effect. Probably because selection and activation are different concepts. There is no setActivated(int) method available.

A:

you can select item with following code:
listView.setItemChecked(position, true);

