Android: How to create an onclick event for a SimpleCursorAdapter?
I have this code:
db=(new DatabaseHelper(this)).getWritableDatabase();
constantsCursor=db.rawQuery("SELECT _ID, title, subtitle, image "+
"FROM news ORDER BY title",
null);
ListAdapter adapter=new SimpleCursorAdapter(this,
R.layout.row, constantsCursor,
new String[] {"title", "subtitle", "image"},
new int[] {R.id.value, R.id.title, R.id.icon});
setListAdapter(adapter);
registerForContextMenu(getListView());
Which displays a list of titles. I d开发者_运维技巧ont however for the life of me know how to create a click event so that i can call another view when i click an item from that list.
Anyone?
If you are extending a ListActivity then you can implement the onListItemClick method. See: http://d.android.com/reference/android/app/ListActivity.html#onListItemClick
精彩评论