Android: How to get selected item in listview using cursor?

I am very new to Android.

Can someone tell me how can I get the selected item from ListViewwhen the data comes fromCursor

Thank.

+3
source share
2 answers

If you created ListActivity(which has ListViewin it), the method onListItemClick()is called every time an entry in the list is clicked. This method has a parameter long idthat contains the identifier of your selected item.

, SQLite ( auto_increment). ListActivity SimpleCursorAdapter, _id ( ID- , AS). , .

, , 12, _id. ListView, onListItemClick() -method id 12.

, (, ).

+3

OnItemClickListener ListView setOnItemClickListener.

, getItem .

, getItem , .

+1

All Articles