The ResourceCursorAdapter
derives from CursorAdapter
and adds also the mInflater
(initialized in constructors). I have seen more than one custom adapter examples derived from SimpleCursorAdapter
(that in turn is based on ResourceCursorAdapter
) that also introduced their own myInflater
for the same purpose.
Is there any reason why the mInflater
was not made protected
instead of private
so that it could be used also in derived classes?
Update: To clarify my question.
Firstly, I am just curious of why the mInflater
was not made protected. What was the reason to do that during design as it would be quite handy when using ResourceCursorAdapter
or its subclass SimpleCursorAdapter
as a base class? I have finally implemented my cursor adapter by extending the CursorAdapter
. Anyway, I am just curious, and I may have overlooked something important...
I want to use the ViewHolder
technique. Because of that, I want to override the newView
(it creates a view holder and attaches it to the newly created view) and bindView
(it gets the attached view holder and fills the data from a cursor). For the newView
method implementation, I need to call the inflater. If I were using the SimpleCursorAdapter
, I would defined the mInflater
initialized by my subclass constructor exactly the same way as the ResourceCursorAdapter
does (to optimize slightly the newView
). For that reason, it would be nice if the superclass mInflater
was available also for subclasses (i.e. no need to define it again in the subclass). This is the core of my question.
ResourceCursorAdapter
is a special adapter that does the inflating for you. For this reason, subclasses of it should not need an inflater.
If you need to inflate a layout, then ResourceCursorAdapter
is probably not the most appropriate choice.