I've been following these 2 tutorials to s开发者_高级运维etup a list & click events:
http://mfarhan133.wordpress.com/2010/10/14/list-view-tutorial-for-android/ http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/comment-page-3/#comments
Everything seems to have worked fine up until putting in the click events:
view.setOnClickListener(new OnClickListener() {
public void onClick(View arg0){...
Clicking on an item in the list will operate the function normally, but it wont change the background colour as it used to. Also, scrolling the list manually and pressing enter / submit button doesn't seem to run the function, although it does change the background colour.
To handle such events you should implement AdapterView.OnItemClickListener interface and set its instance to a list view via list.setOnItemClickListener() method.
精彩评论