So I’ve been modifying the notepad tutorial code: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html .
Basically what I want to do is to create specific layout styles (i.e. background color) for different rows within the ListView based on the content. So for example, the text for the title is “1” so the background of that row will be red. Or, if the text for the title is “2” then the background of that row (or list item) will be green.
What I’m trying to accomplish is to have a summary of the the rows in the database and color-code each row based upon what category (numerical field) the item is stored as.
They use SimpleCursorAdapter, and you need to write your own in order to change the output. In your adapter, which handles the presentation of your data, you can override the method getView(). Then populate each row with the data from the db. And depending on the data, set a different background color.