简体   繁体   中英

How to make list view items clickable? Android SQL Lite DB

i will attempt to keep this short and concise. I am currently developing an android application, and am stuck on a particular element.

The below is an example code i have been reading through, from my understanding it is taking a list of values inserting them in to the db / table, then cycling through them with the cursor and displaying with the list view. On running the application all items are displayed in a list as expected.

I would like it so that when an item in the list is clicked a new page is opened via intent, or a different set of database values is displayed on the current page.

How could this be achieved

Thank you!

Implement this method

 protected void onListItemClick(ListView l, View v, int position, long id) 

This method will be called when an item in the list is selected. Subclasses should override. Subclasses can call getListView().getItemAtPosition(position) if they need to access the data associated with the selected item.

Parameters:

  • l ListView : The ListView where the click happened
  • v View : The view that was clicked within the ListView
  • position int : The position of the view in the list
  • id long : The row id of the item that was clicked

ListActivity - Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM