Stay organized with collections
Save and categorize content based on your preferences.
ResourceCursorTreeAdapter
abstract class ResourceCursorTreeAdapter : CursorTreeAdapter
Known Direct Subclasses
SimpleCursorTreeAdapter |
An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file.
|
|
A fairly simple ExpandableListAdapter that creates views defined in an XML file. You can specify the XML file that defines the appearance of the views.
Summary
Public constructors |
Constructor.
|
Constructor.
|
Constructor.
|
Inherited functions |
From class BaseExpandableListAdapter
Boolean |
areAllItemsEnabled()
|
Int |
getChildType(groupPosition: Int, childPosition: Int)
Get the type of child View that will be created by android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup) for the specified child item.
|
Int |
getChildTypeCount()
Returns the number of types of child Views that will be created by android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup) . Each type represents a set of views that can be converted in android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup) , for any group. If the adapter always returns the same type of View for all child items, this method should return 1.
This method will only be called when the adapter is set on the AdapterView .
|
Long |
getCombinedChildId(groupId: Long, childId: Long)
Override this method if you foresee a clash in IDs based on this scheme:
Base implementation returns a long:
bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 1.
bit 1-31: Lower 31 bits of the groupId
bit 32-63: Lower 32 bits of the childId.
Gets an ID for a child that is unique across any item (either group or child) that is in this list. Expandable lists require each item (group or child) to have a unique ID among all children and groups in the list. This method is responsible for returning that unique ID given a child's ID and its group's ID. Furthermore, if hasStableIds() is true, the returned ID must be stable as well.
|
Long |
getCombinedGroupId(groupId: Long)
Override this method if you foresee a clash in IDs based on this scheme:
Base implementation returns a long:
bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 0.
bit 1-31: Lower 31 bits of the groupId
bit 32-63: Lower 32 bits of the childId.
Gets an ID for a group that is unique across any item (either group or child) that is in this list. Expandable lists require each item (group or child) to have a unique ID among all children and groups in the list. This method is responsible for returning that unique ID given a group's ID. Furthermore, if hasStableIds() is true, the returned ID must be stable as well.
|
Int |
getGroupType(groupPosition: Int)
Get the type of group View that will be created by android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup) . for the specified group item.
|
Int |
getGroupTypeCount()
Returns the number of types of group Views that will be created by android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup) . Each type represents a set of views that can be converted in android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup) . If the adapter always returns the same type of View for all group items, this method should return 1.
This method will only be called when the adapter is set on the AdapterView .
|
Boolean |
isEmpty()
|
Unit |
onGroupExpanded(groupPosition: Int)
|
Unit |
registerDataSetObserver(observer: DataSetObserver!)
|
Unit |
unregisterDataSetObserver(observer: DataSetObserver!)
|
|
From class CursorTreeAdapter
Unit |
bindChildView(view: View!, context: Context!, cursor: Cursor!, isLastChild: Boolean)
Bind an existing view to the child data pointed to by cursor
|
Unit |
bindGroupView(view: View!, context: Context!, cursor: Cursor!, isExpanded: Boolean)
Bind an existing view to the group data pointed to by cursor.
|
Unit |
changeCursor(cursor: Cursor!)
|
String! |
convertToString(cursor: Cursor!)
|
Cursor! |
getChild(groupPosition: Int, childPosition: Int)
|
Long |
getChildId(groupPosition: Int, childPosition: Int)
|
View! |
getChildView(groupPosition: Int, childPosition: Int, isLastChild: Boolean, convertView: View!, parent: ViewGroup!)
|
Int |
getChildrenCount(groupPosition: Int)
|
Cursor! |
getChildrenCursor(groupCursor: Cursor!)
Gets the Cursor for the children at the given group. Subclasses must implement this method to return the children data for a particular group.
If you want to asynchronously query a provider to prevent blocking the UI, it is possible to return null and at a later time call setChildrenCursor(int,android.database.Cursor) .
It is your responsibility to manage this Cursor through the Activity lifecycle. It is a good idea to use Activity.managedQuery which will handle this for you. In some situations, the adapter will deactivate the Cursor on its own, but this will not always be the case, so please ensure the Cursor is properly managed.
|
Cursor! |
getCursor()
|
Filter! |
getFilter()
|
FilterQueryProvider! |
getFilterQueryProvider()
|
Cursor! |
getGroup(groupPosition: Int)
|
Int |
getGroupCount()
|
Long |
getGroupId(groupPosition: Int)
|
View! |
getGroupView(groupPosition: Int, isExpanded: Boolean, convertView: View!, parent: ViewGroup!)
|
Boolean |
hasStableIds()
|
Boolean |
isChildSelectable(groupPosition: Int, childPosition: Int)
|
Unit |
notifyDataSetChanged()
|
Unit |
notifyDataSetChanged(releaseCursors: Boolean)
Notifies a data set change, but with the option of not releasing any cached cursors.
|
Unit |
notifyDataSetInvalidated()
|
Unit |
onGroupCollapsed(groupPosition: Int)
|
Cursor! |
runQueryOnBackgroundThread(constraint: CharSequence!)
|
Unit |
setChildrenCursor(groupPosition: Int, childrenCursor: Cursor!)
Sets the children Cursor for a particular group. If there is an existing cursor it will be closed.
This is useful when asynchronously querying to prevent blocking the UI.
|
Unit |
setFilterQueryProvider(filterQueryProvider: FilterQueryProvider!)
|
Unit |
setGroupCursor(cursor: Cursor!)
Sets the group Cursor.
|
|
From class ExpandableListAdapter
Any! |
getChild(groupPosition: Int, childPosition: Int)
Gets the data associated with the given child within the given group.
|
Long |
getChildId(groupPosition: Int, childPosition: Int)
Gets the ID for the given child within the given group. This ID must be unique across all children within the group. The combined ID (see getCombinedChildId(long,long) ) must be unique across ALL items (groups and all children).
|
View! |
getChildView(groupPosition: Int, childPosition: Int, isLastChild: Boolean, convertView: View!, parent: ViewGroup!)
Gets a View that displays the data for the given child within the given group.
|
Int |
getChildrenCount(groupPosition: Int)
Gets the number of children in a specified group.
|
Any! |
getGroup(groupPosition: Int)
Gets the data associated with the given group.
|
Int |
getGroupCount()
Gets the number of groups.
|
Long |
getGroupId(groupPosition: Int)
Gets the ID for the group at the given position. This group ID must be unique across groups. The combined ID (see getCombinedGroupId(long) ) must be unique across ALL items (groups and all children).
|
View! |
getGroupView(groupPosition: Int, isExpanded: Boolean, convertView: View!, parent: ViewGroup!)
Gets a View that displays the given group. This View is only for the group--the Views for the group's children will be fetched using getChildView(int,int,boolean,android.view.View,android.view.ViewGroup) .
|
Boolean |
hasStableIds()
Indicates whether the child and group IDs are stable across changes to the underlying data.
|
Boolean |
isChildSelectable(groupPosition: Int, childPosition: Int)
Whether the child at the specified position is selectable.
|
|
Public constructors
ResourceCursorTreeAdapter
ResourceCursorTreeAdapter(
context: Context!,
cursor: Cursor!,
groupLayout: Int,
childLayout: Int)
Constructor.
Parameters |
context |
Context!: The context where the ListView associated with this SimpleListItemFactory is running |
cursor |
Cursor!: The database cursor |
groupLayout |
Int: resource identifier of a layout file that defines the views for all groups. |
childLayout |
Int: resource identifier of a layout file that defines the views for all children. |
ResourceCursorTreeAdapter
ResourceCursorTreeAdapter(
context: Context!,
cursor: Cursor!,
collapsedGroupLayout: Int,
expandedGroupLayout: Int,
childLayout: Int)
Constructor.
Parameters |
context |
Context!: The context where the ListView associated with this SimpleListItemFactory is running |
cursor |
Cursor!: The database cursor |
collapsedGroupLayout |
Int: resource identifier of a layout file that defines the views for collapsed groups. |
expandedGroupLayout |
Int: resource identifier of a layout file that defines the views for expanded groups. |
childLayout |
Int: resource identifier of a layout file that defines the views for all children. |
ResourceCursorTreeAdapter
ResourceCursorTreeAdapter(
context: Context!,
cursor: Cursor!,
collapsedGroupLayout: Int,
expandedGroupLayout: Int,
childLayout: Int,
lastChildLayout: Int)
Constructor.
Parameters |
context |
Context!: The context where the ListView associated with this SimpleListItemFactory is running |
cursor |
Cursor!: The database cursor |
collapsedGroupLayout |
Int: resource identifier of a layout file that defines the views for collapsed groups. |
expandedGroupLayout |
Int: resource identifier of a layout file that defines the views for expanded groups. |
childLayout |
Int: resource identifier of a layout file that defines the views for all children but the last.. |
lastChildLayout |
Int: resource identifier of a layout file that defines the views for the last child of a group. |
Public methods
newChildView
open fun newChildView(
context: Context!,
cursor: Cursor!,
isLastChild: Boolean,
parent: ViewGroup!
): View!
Parameters |
context |
Context!: Interface to application's global information |
cursor |
Cursor!: The cursor from which to get the data. The cursor is already moved to the correct position. |
isLastChild |
Boolean: Whether the child is the last child within its group. |
parent |
ViewGroup!: The parent to which the new view is attached to |
Return |
View! |
the newly created view. |
newGroupView
open fun newGroupView(
context: Context!,
cursor: Cursor!,
isExpanded: Boolean,
parent: ViewGroup!
): View!
Parameters |
context |
Context!: Interface to application's global information |
cursor |
Cursor!: The group cursor from which to get the data. The cursor is already moved to the correct position. |
isExpanded |
Boolean: Whether the group is expanded. |
parent |
ViewGroup!: The parent to which the new view is attached to |
Return |
View! |
The newly created view. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-12-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-18 UTC."],[],[]]