tags:

views:

53

answers:

1

Hi,

I have a ListView in my android application. If I flick up/down the ListView, which method will return my 'selected' element in my list View? How about if I use the track ball to navigate up/down my list view, which method will return the index of my selected element?

Thank you.

A: 

If I flick up/down the ListView, which method will return my 'selected' element in my list View?

None will, because selection is only through the trackball/D-pad.

How about if I use the track ball to navigate up/down my list view, which method will return the index of my selected element?

getSelectedItem(), getSelectedItemId() (for CursorAdapter), and getSelectedItemPosition().

CommonsWare