本文整理汇总了Java中android.widget.ExpandableListAdapter.getGroupId方法的典型用法代码示例。如果您正苦于以下问题:Java ExpandableListAdapter.getGroupId方法的具体用法?Java ExpandableListAdapter.getGroupId怎么用?Java ExpandableListAdapter.getGroupId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ExpandableListAdapter
的用法示例。
在下文中一共展示了ExpandableListAdapter.getGroupId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandGroups
import android.widget.ExpandableListAdapter; //导入方法依赖的package包/类
public void expandGroups(long[] groupsToExpand)
{
// this.expandedIds = expandedIds;
if (groupsToExpand != null && groupsToExpand.length > 0)
{
ExpandableListAdapter adapter = getExpandableListAdapter();
if (adapter != null)
{
for (int i = 0; i < adapter.getGroupCount(); i++)
{
long id = adapter.getGroupId(i);
if (inArray(groupsToExpand, id))
{
expandGroup(i);
}
}
}
}
}
示例2: restoreExpandedState
import android.widget.ExpandableListAdapter; //导入方法依赖的package包/类
private void restoreExpandedState(ArrayList<Long> expandedIds) {
this.expandedIds = expandedIds;
if (expandedIds != null) {
ExpandableListView list = mList;
ExpandableListAdapter adapter = mAdapter;
if (adapter != null) {
for (int i=0; i<adapter.getGroupCount(); i++) {
long id = adapter.getGroupId(i);
if (expandedIds.contains(id)) list.expandGroup(i);
}
}
}
}
示例3: findGroupPosition
import android.widget.ExpandableListAdapter; //导入方法依赖的package包/类
int findGroupPosition(long groupIdToMatch, int seedGroupPosition) {
int count = mExpandableListAdapter.getGroupCount();
if (count == 0) {
return AdapterView.INVALID_POSITION;
}
if (groupIdToMatch == AdapterView.INVALID_ROW_ID) {
return AdapterView.INVALID_POSITION;
}
seedGroupPosition = Math.max(0, seedGroupPosition);
seedGroupPosition = Math.min(count - 1, seedGroupPosition);
long endTime = SystemClock.uptimeMillis() + AdapterView.SYNC_MAX_DURATION_MILLIS;
long rowId;
int first = seedGroupPosition;
int last = seedGroupPosition;
boolean next = false;
boolean hitFirst;
boolean hitLast;
ExpandableListAdapter adapter = getAdapter();
if (adapter == null) {
return AdapterView.INVALID_POSITION;
}
while (SystemClock.uptimeMillis() <= endTime) {
rowId = adapter.getGroupId(seedGroupPosition);
if (rowId == groupIdToMatch) {
return seedGroupPosition;
}
hitLast = last == count - 1;
hitFirst = first == 0;
if (hitLast && hitFirst) {
break;
}
if (hitFirst || next && !hitLast) {
last++;
seedGroupPosition = last;
next = false;
} else if (hitLast || !next && !hitFirst) {
first--;
seedGroupPosition = first;
next = true;
}
}
return AdapterView.INVALID_POSITION;
}