views:

38

answers:

1

hi i have a simple list view control my queries are:

1) how to set first row selected on start (after fill data in list view)

2) when i navigate by hardware button i got AdapterView.OnItemSelectedListener and color of row background change, but when i click i not get any OnItemSelectedListener and no row selected. How to select row on click.

3) when i change focus list row selection removed,

please any one with any solution, code example or articles i search but no susses

with regards Chandra Kant Singh

A: 

how to set first row selected on start (after fill data in list view)

Call setSelection() on the ListView. However, this only will have a visual effect if the user entered your activity via the pointing device (trackball, D-pad, etc.).

How to select row on click.

You don't.

when i change focus list row selection removed,

If I understand what you mean by "change focus", this is working as designed.

Please review this article on touch mode and the use of the "selected" state, then adjust your UI design to follow Android conventions. Selection is only used when the user navigates with the pointing device, not when the user uses the touch screen.

CommonsWare
setSelection() does not have the required visual effect as you say. Then how can the item be highlighted to the user in other cases? Is there no way this can be achieved?
kiki