android.widget.ExpandableListAdapter.getChild()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中android.widget.ExpandableListAdapter.getChild()方法的一些代码示例,展示了ExpandableListAdapter.getChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpandableListAdapter.getChild()方法的具体详情如下:
包路径:android.widget.ExpandableListAdapter
类名称:ExpandableListAdapter
方法名:getChild

ExpandableListAdapter.getChild介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onChildClick(ExpandableListView parent, View v,
              int groupPosition, int childPosition,
              long id) {
 Toast.makeText(this,
         adapter.getChild(groupPosition, childPosition)
            .toString(), Toast.LENGTH_SHORT).show();
 return(false);
}

代码示例来源:origin: stackoverflow.com

CustomChilds child = listAdapter.getChild(i, k);
String unit=child.getUnit();
String note=child.getNote();

代码示例来源:origin: stackoverflow.com

ExpandableListAdapter itemAdapter = parent.getExpandableListAdapter(); 
String selectedItem = (String) itemAdapter.getChild(groupPosition, childPosition);

代码示例来源:origin: stackoverflow.com

ExpandableListAdapter adapter = ExpandList.getExpandableListAdapter();
ExpandListChild elc = adapter.getChild(groupPosition, childPosition);
String selected = elc.getName();

代码示例来源:origin: stackoverflow.com

ExpandableListAdapter adapter = getExpandableListAdapter();
gametype = adapter.getChild(groupPosition, childPosition).toString;

代码示例来源:origin: xiangzhihong/gpuImage

public Object getItem( int flatListPos ) {
  final PositionMetadata posMetadata = getUnflattenedPos( flatListPos );
  Object retValue;
  if( posMetadata.position.type == ExpandableHListPosition.GROUP ) {
    retValue = mExpandableListAdapter.getGroup( posMetadata.position.groupPos );
  }
  else if( posMetadata.position.type == ExpandableHListPosition.CHILD ) {
    retValue = mExpandableListAdapter.getChild( posMetadata.position.groupPos, posMetadata.position.childPos );
  }
  else {
    // TODO: clean exit
    throw new RuntimeException( "Flat list position is of unknown type" );
  }
  posMetadata.recycle();
  return retValue;
}

代码示例来源:origin: jp1017/ActivityLauncher

@Override
  public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
    ExpandableListAdapter adapter = parent.getExpandableListAdapter();
    MyActivityInfo info = (MyActivityInfo)adapter.getChild(groupPosition, childPosition);
    LauncherIconCreator.launchActivity(getActivity(), info.component_name);
    return false;
  }
});

代码示例来源:origin: zulip/zulip-android

@Override
  public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
    switch (v.getId()) {
      case R.id.name_child_container:
        String streamName = ((Cursor) streamsDrawer.getExpandableListAdapter().getGroup(groupPosition)).getString(1);
        String subjectName = ((Cursor) streamsDrawer.getExpandableListAdapter().getChild(groupPosition, childPosition)).getString(0);
        onNarrow(new NarrowFilterStream(streamName, subjectName));
        onNarrowFillSendBoxStream(streamName, subjectName, false);
        break;
      default:
        return false;
    }
    return false;
  }
});

代码示例来源:origin: stackoverflow.com

public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
    ExpandableListAdapter itemAdapter = parent.getExpandableListAdapter();
    String selectedItem = (String)itemAdapter.getChild(groupPosition, childPosition);
    groupHeader(selectedItem);
    if(parent.isGroupExpanded(groupPosition))
    {
      parent.collapseGroup(groupPosition);
    }
    // your logic here
    // expandableListArrayList.add() or expandableListArrayList.remove()
    // or whatever 
    itemAdapter.notifyDataSetChanged();

    return true;
  }
});

代码示例来源:origin: PrivacyApps/document-viewer

protected Object getContextMenuSource(final View v, final ContextMenuInfo menuInfo) {
  Object source = null;
  if (menuInfo instanceof AdapterContextMenuInfo) {
    final AbsListView list = (AbsListView) v;
    final AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo;
    source = list.getAdapter().getItem(mi.position);
  } else if (menuInfo instanceof ExpandableListContextMenuInfo) {
    final ExpandableListView list = (ExpandableListView) v;
    final ExpandableListAdapter adapter = list.getExpandableListAdapter();
    final ExpandableListContextMenuInfo mi = (ExpandableListContextMenuInfo) menuInfo;
    final long pp = mi.packedPosition;
    final int group = ExpandableListView.getPackedPositionGroup(pp);
    final int child = ExpandableListView.getPackedPositionChild(pp);
    if (child >= 0) {
      source = adapter.getChild(group, child);
    } else {
      source = adapter.getGroup(group);
    }
  }
  return source;
}

代码示例来源:origin: PrivacyApps/document-viewer

protected Object getContextMenuSource(final View v, final ContextMenuInfo menuInfo) {
  Object source = null;
  if (menuInfo instanceof AdapterContextMenuInfo) {
    final AbsListView list = (AbsListView) v;
    final AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo;
    source = list.getAdapter().getItem(mi.position);
  } else if (menuInfo instanceof ExpandableListContextMenuInfo) {
    final ExpandableListView list = (ExpandableListView) v;
    final ExpandableListAdapter adapter = list.getExpandableListAdapter();
    final ExpandableListContextMenuInfo mi = (ExpandableListContextMenuInfo) menuInfo;
    final long pp = mi.packedPosition;
    final int group = ExpandableListView.getPackedPositionGroup(pp);
    final int child = ExpandableListView.getPackedPositionChild(pp);
    if (child >= 0) {
      source = adapter.getChild(group, child);
    } else {
      source = adapter.getGroup(group);
    }
  }
  return source;
}

代码示例来源:origin: stackoverflow.com

int groupPosition, int childPosition, long id) {
Object x =adapter.getChild(groupPosition, childPosition);

代码示例来源:origin: jp1017/ActivityLauncher

MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition));
switch(item.getItemId()) {
case 0:

代码示例来源:origin: stackoverflow.com

final String selected = (String) listAdapter.getChild(
    groupPosition, childPosition);
mDrawerListView.smoothScrollToPosition(groupPosition);

代码示例来源:origin: jp1017/ActivityLauncher

@Override
public void onCreateContextMenu(ContextMenu menu, View v,
    ContextMenuInfo menuInfo) {
  menu.add(Menu.NONE, 0, Menu.NONE, R.string.context_action_shortcut);
  menu.add(Menu.NONE, 1, Menu.NONE, R.string.context_action_launch);
  
  ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo)menuInfo;
  ExpandableListView list = (ExpandableListView) getView().findViewById(R.id.expandableListView1);
  
  switch(ExpandableListView.getPackedPositionType(info.packedPosition)) {
  case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
    MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition));
    menu.setHeaderIcon(activity.icon);
    menu.setHeaderTitle(activity.name);
    menu.add(Menu.NONE, 2, Menu.NONE, R.string.context_action_edit);
    break;
  case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
    MyPackageInfo pack = (MyPackageInfo) list.getExpandableListAdapter().getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition));
    menu.setHeaderIcon(pack.icon);
    menu.setHeaderTitle(pack.name);
    break;
  }
  super.onCreateContextMenu(menu, v, menuInfo);
}

相关文章