How to extend Android's SimpleCursorView?
There is no SimpleCursorView
in Android. For the rest of this answer, I will presume that you are referring to SimpleCursorAdapter
.
I would like to extend SimpleCursorView, to add an } else if (c instanceof MyView) { setMyViewMyThing(MyView v, text) to the bindView method.
Everybody else would use setViewBinder()
to supply their own ViewBinder
. Quoting the documentation for ViewBinder
:
You should use this class to bind values from the Cursor to views that are not directly supported by SimpleCursorAdapter or to change the way binding occurs for views supported by SimpleCursorAdapter.
Of course, you do not have to do this.
Is there a better way to achieve my objective than to copy the source of SimpleCursorView wholesale into a MyCursorView and add my condition to bindView?
Besides using ViewBinder
? Probably not.
On a meta-level, it looks like the Android authors have traded my freedom to extend SimpleCursorView for their freedom to change the implementation.
"On a meta-level", it looks like the Android authors favored composition over inheritance.