public abstract class SimpleCursorTreeAdapter extends ResourceCursorTreeAdapter
SimpleCursorTreeAdapter.ViewBinder
is available,
SimpleCursorTreeAdapter.ViewBinder.setViewValue(android.view.View, android.database.Cursor, int)
is invoked. If the returned value is true, binding has occurred. If the
returned value is false and the view to bind is a TextView,
setViewText(TextView, String)
is invoked. If the returned value
is false and the view to bind is an ImageView,
setViewImage(ImageView, String)
is invoked. If no appropriate
binding can be found, an IllegalStateException
is thrown.Modifier and Type | Class and Description |
---|---|
static interface |
SimpleCursorTreeAdapter.ViewBinder
This class can be used by external clients of SimpleCursorTreeAdapter
to bind values from the Cursor to views.
|
Constructor and Description |
---|
SimpleCursorTreeAdapter(Context context,
Cursor cursor,
int collapsedGroupLayout,
int expandedGroupLayout,
String[] groupFrom,
int[] groupTo,
int childLayout,
int lastChildLayout,
String[] childFrom,
int[] childTo)
Constructor.
|
SimpleCursorTreeAdapter(Context context,
Cursor cursor,
int collapsedGroupLayout,
int expandedGroupLayout,
String[] groupFrom,
int[] groupTo,
int childLayout,
String[] childFrom,
int[] childTo)
Constructor.
|
SimpleCursorTreeAdapter(Context context,
Cursor cursor,
int groupLayout,
String[] groupFrom,
int[] groupTo,
int childLayout,
String[] childFrom,
int[] childTo)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
bindChildView(View view,
Context context,
Cursor cursor,
boolean isLastChild)
Bind an existing view to the child data pointed to by cursor
|
protected void |
bindGroupView(View view,
Context context,
Cursor cursor,
boolean isExpanded)
Bind an existing view to the group data pointed to by cursor.
|
SimpleCursorTreeAdapter.ViewBinder |
getViewBinder()
Returns the
SimpleCursorTreeAdapter.ViewBinder used to bind data to views. |
void |
setViewBinder(SimpleCursorTreeAdapter.ViewBinder viewBinder)
Sets the binder used to bind data to views.
|
protected void |
setViewImage(ImageView v,
String value)
Called by bindView() to set the image for an ImageView.
|
void |
setViewText(TextView v,
String text)
Called by bindView() to set the text for a TextView but only if
there is no existing ViewBinder or if the existing ViewBinder cannot
handle binding to a TextView.
|
newChildView, newGroupView
changeCursor, convertToString, getChild, getChildId, getChildrenCount, getChildrenCursor, getChildView, getCursor, getFilter, getFilterQueryProvider, getGroup, getGroupCount, getGroupId, getGroupView, hasStableIds, isChildSelectable, notifyDataSetChanged, notifyDataSetChanged, notifyDataSetInvalidated, onGroupCollapsed, runQueryOnBackgroundThread, setChildrenCursor, setFilterQueryProvider, setGroupCursor
areAllItemsEnabled, getChildType, getChildTypeCount, getCombinedChildId, getCombinedGroupId, getGroupType, getGroupTypeCount, isEmpty, onGroupExpanded, registerDataSetObserver, unregisterDataSetObserver
public SimpleCursorTreeAdapter(Context context, Cursor cursor, int collapsedGroupLayout, int expandedGroupLayout, String[] groupFrom, int[] groupTo, int childLayout, int lastChildLayout, String[] childFrom, int[] childTo)
context
- The context where the ExpandableListView
associated with this SimpleCursorTreeAdapter
is
runningcursor
- The database cursorcollapsedGroupLayout
- The resource identifier of a layout file that
defines the views for a collapsed group. The layout file
should include at least those named views defined in groupTo.expandedGroupLayout
- The resource identifier of a layout file that
defines the views for an expanded group. The layout file
should include at least those named views defined in groupTo.groupFrom
- A list of column names that will be used to display the
data for a group.groupTo
- The group views (from the group layouts) that should
display column in the "from" parameter. These should all be
TextViews or ImageViews. The first N views in this list are
given the values of the first N columns in the from parameter.childLayout
- The resource identifier of a layout file that defines
the views for a child (except the last). The layout file
should include at least those named views defined in childTo.lastChildLayout
- The resource identifier of a layout file that
defines the views for the last child within a group. The
layout file should include at least those named views defined
in childTo.childFrom
- A list of column names that will be used to display the
data for a child.childTo
- The child views (from the child layouts) that should
display column in the "from" parameter. These should all be
TextViews or ImageViews. The first N views in this list are
given the values of the first N columns in the from parameter.public SimpleCursorTreeAdapter(Context context, Cursor cursor, int collapsedGroupLayout, int expandedGroupLayout, String[] groupFrom, int[] groupTo, int childLayout, String[] childFrom, int[] childTo)
context
- The context where the ExpandableListView
associated with this SimpleCursorTreeAdapter
is
runningcursor
- The database cursorcollapsedGroupLayout
- The resource identifier of a layout file that
defines the views for a collapsed group. The layout file
should include at least those named views defined in groupTo.expandedGroupLayout
- The resource identifier of a layout file that
defines the views for an expanded group. The layout file
should include at least those named views defined in groupTo.groupFrom
- A list of column names that will be used to display the
data for a group.groupTo
- The group views (from the group layouts) that should
display column in the "from" parameter. These should all be
TextViews or ImageViews. The first N views in this list are
given the values of the first N columns in the from parameter.childLayout
- The resource identifier of a layout file that defines
the views for a child. The layout file
should include at least those named views defined in childTo.childFrom
- A list of column names that will be used to display the
data for a child.childTo
- The child views (from the child layouts) that should
display column in the "from" parameter. These should all be
TextViews or ImageViews. The first N views in this list are
given the values of the first N columns in the from parameter.public SimpleCursorTreeAdapter(Context context, Cursor cursor, int groupLayout, String[] groupFrom, int[] groupTo, int childLayout, String[] childFrom, int[] childTo)
context
- The context where the ExpandableListView
associated with this SimpleCursorTreeAdapter
is
runningcursor
- The database cursorgroupLayout
- The resource identifier of a layout file that defines
the views for a group. The layout file should include at least
those named views defined in groupTo.groupFrom
- A list of column names that will be used to display the
data for a group.groupTo
- The group views (from the group layouts) that should
display column in the "from" parameter. These should all be
TextViews or ImageViews. The first N views in this list are
given the values of the first N columns in the from parameter.childLayout
- The resource identifier of a layout file that defines
the views for a child. The layout file should include at least
those named views defined in childTo.childFrom
- A list of column names that will be used to display the
data for a child.childTo
- The child views (from the child layouts) that should
display column in the "from" parameter. These should all be
TextViews or ImageViews. The first N views in this list are
given the values of the first N columns in the from parameter.public SimpleCursorTreeAdapter.ViewBinder getViewBinder()
SimpleCursorTreeAdapter.ViewBinder
used to bind data to views.setViewBinder(android.widget.SimpleCursorTreeAdapter.ViewBinder)
public void setViewBinder(SimpleCursorTreeAdapter.ViewBinder viewBinder)
viewBinder
- the binder used to bind data to views, can be null to
remove the existing bindergetViewBinder()
protected void bindChildView(View view, Context context, Cursor cursor, boolean isLastChild)
CursorTreeAdapter
bindChildView
in class CursorTreeAdapter
view
- Existing view, returned earlier by newChildViewcontext
- Interface to application's global informationcursor
- The cursor from which to get the data. The cursor is
already moved to the correct position.isLastChild
- Whether the child is the last child within its group.protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded)
CursorTreeAdapter
bindGroupView
in class CursorTreeAdapter
view
- Existing view, returned earlier by newGroupView.context
- Interface to application's global informationcursor
- The cursor from which to get the data. The cursor is
already moved to the correct position.isExpanded
- Whether the group is expanded.protected void setViewImage(ImageView v, String value)
v
- ImageView to receive an imagevalue
- the value retrieved from the cursorpublic void setViewText(TextView v, String text)
v
- TextView to receive texttext
- the text to be set for the TextView