I’d like to make a listview that used the ListView.CHOICE_MODE_SINGLE so that the user could only select one thing at a time. However, I want the background to change to the focused color when selected, rather than a checkbox checking off. A good example of what I’m trying to do would be basically any file browser, where the background changes color on each item you select in sequence.
Any help?
What you’ll want to do here is define a class that implements ListAdapter. ListAdapter has a method called getView that the ListActivity will use when it is drawing itself. Define getView so that it returns a view which has a different background color if the item is selected.
UPDATE
To respond to a click on an item: In your listActivity, override onListItemClick. In that method, call a method on your adapter to update itself with the click info. Then your adapter should call the onChanged method for each of its observers. If you are not using listActivity, then you can use the setOnItemClickListener method of the ListView to set a callback for this event.