开发者

android ListView question

开发者 https://www.devze.com 2022-12-29 08:14 出处:网络
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 n

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.


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().

0

精彩评论

暂无评论...
验证码 换一张
取 消