finiteloop
finiteloop

Reputation: 4496

Intercepting SimpleCursorAdapter Action

I am writing an application which is using a SimpleCursorAdapter to display a list of items from my SQLite Database. The application is a list application, which allows the user to create a list of items. There is a field in the database that keeps track of whether the user wants the list item's text crossed out or not.

Basically, I want to intercept the point in time where the SimpleCursorAdapter tries to settext() on my crossed_out field, and instead call a function to set the text of another field to strikethrough.

Is this possible without writing my own CursorAdapter? If not how can I go about writing my own CursorAdapter?

Upvotes: 2

Views: 333

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006869

Is this possible without writing my own CursorAdapter?

You can attach a ViewBinder using setViewBinder(), and implement a ViewBinder to format your TextViews as you wish.

If not how can I go about writing my own CursorAdapter?

Step #1: Create a subclass of SimpleCursorAdapter

Step #2: Override setViewText() and apply your formatting at that point, or override bindView() and fill in all of the row widgets yourself

Upvotes: 2

Related Questions