本文整理匯總了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;
}