ExpandableListView isGroupExpanded - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ExpandableListView isGroupExpanded method.

This code example shows how to use the following methods:getChildAt, pointToPosition, getExpandableListPosition, isGroupExpanded
        // The first visible flat item position 
        final int fvPos = view.getFirstVisiblePosition();
        final int fPos = view.pointToPosition(0, 0);
        if (fPos != AdapterView.INVALID_POSITION) {
            // To get the corresponds packed position. 
            final long pPos = mList.getExpandableListPosition(fPos);
            // To check whether the packed position is header or footer. 
            if (pPos != ExpandableListView.PACKED_POSITION_VALUE_NULL) {
                // Extract the group and child position. 
                final int groupPos = ExpandableListView.getPackedPositionGroup(pPos);
                final int childPos = ExpandableListView.getPackedPositionChild(pPos);
                if (childPos == AdapterView.INVALID_POSITION) {
                    // The flat position is a group item, no child item. 
                    // Then try to get the group item height. 
                    indicatorGroupHeight = mList.getChildAt(fPos - fvPos).getHeight();
                } 
                if (indicatorGroupHeight == 0) {
                    return; 
                } 
                // Set the flotView's visibility and data. 

5
CodeRank
This code example shows how to use the following methods:getChildAt, pointToPosition, getExpandableListPosition, isGroupExpanded, getFirstVisiblePosition
5
CodeRank
This code example shows how to use the following methods:isGroupExpanded
        mListUtil.arrowScrollToSelectedPosition(0);
        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
        getInstrumentation().waitForIdleSync();
 
        // Ensure it expanded 
        assertTrue("Group did not expand", mListView.isGroupExpanded(0));
         
        // Wait until that's all good 
        getInstrumentation().waitForIdleSync();
         
        // Make sure it expanded 
        assertTrue("Group did not expand", mListView.isGroupExpanded(0));
         
        // Insert a collapsed group in front of the one just expanded 
        List<MyGroup> groups = mActivity.getGroups();
        MyGroup insertedGroup = new MyGroup(1);
        groups.add(0, insertedGroup);
         
        // Notify data change 
        assertTrue("Adapter is not an instance of the base adapter",

5
CodeRank
This code example shows how to use the following methods:isGroupExpanded
        mListUtil.arrowScrollToSelectedPosition(0);
        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
        getInstrumentation().waitForIdleSync();
 
        // Ensure it expanded 
        assertTrue("Group did not expand", mListView.isGroupExpanded(0));
         
        // Wait until that's all good 
        getInstrumentation().waitForIdleSync();
         
        // Make sure it expanded 
        assertTrue("Group did not expand", mListView.isGroupExpanded(0));
         
        // Insert a collapsed group in front of the one just expanded 
        List<MyGroup> groups = mActivity.getGroups();
        MyGroup insertedGroup = new MyGroup(1);
        groups.add(0, insertedGroup);
         
        // Notify data change 
        assertTrue("Adapter is not an instance of the base adapter",

5
CodeRank
This code example shows how to use the following methods:collapseGroup, isGroupExpanded
    } 
     
    @Override 
    public boolean onGroupClick(ExpandableListView parent, View v,
            int groupPosition, long id) {
        if (!parent.isGroupExpanded(groupPosition)) {
            VersionedExpandGroup.newInstance().create(parent)
                    .expandGroup(groupPosition);
        } 
        else { 
            parent.collapseGroup(groupPosition);
        } 
        return true; 
    } 
     
    @Override 
    public void onGroupExpand(int groupPosition) {}
 
    @Override 
    public void onGroupCollapse(int groupPosition) {}
4
CodeRank
This code example shows how to use the following methods:collapseGroup, isGroupExpanded
			int groupPosition, long id) {
		if(DEBUG){
			Log.d(TAG, "Group clicked! ");
		}		 
		 
		boolean expanded = mListView.isGroupExpanded(groupPosition);
		//just toggle the expanding 
		if (expanded){
			mListView.collapseGroup(groupPosition);
			return true; 
		} 
		 
		mListView.expandGroup(groupPosition);
		loadGroup(groupPosition);
		return true; 
	} 
	 
	private void loadGroup(int groupPosition) {
		 
		long groupId;
4
CodeRank
This code example shows how to use the following methods:collapseGroup, isGroupExpanded
        showDialog(Util.TRACK_ACTIONS_DIALOG);
    } 
 
    @Implement 
    public void onGroupClick(int position) {
        if (list.isGroupExpanded(position))
            list.collapseGroup(position);
        else 
            list.expandGroup(position);
    } 
 
    @Implement 
    public void onChildLongClick(final int position, final Cursor cursor) {
        this.position = position;
        childCursor = cursor;
        dialogManager = new DialogManager(this, this, Util.CATEGORIES.TRACK);
        showDialog(Util.TRACK_ACTIONS_DIALOG);
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:expandGroup, isGroupExpanded
    } 
     
    @Override 
    public boolean onGroupClick(ExpandableListView parent, View v,
            int groupPosition, long id) {
        if (!parent.isGroupExpanded(groupPosition)) {
            parent.expandGroup(groupPosition);
        } 
        else { 
            parent.collapseGroup(groupPosition);
        } 
        return true; 
    } 
     
    @Override 
    public void onGroupExpand(int groupPosition) {}
 
    @Override 
    public void onGroupCollapse(int groupPosition) {}
 
4
CodeRank
This code example shows how to use the following methods:isGroupExpanded
    public void testExpandOnFirstPosition() { 
        // Should be a header, and hence the first group should NOT have expanded 
        mListUtil.arrowScrollToSelectedPosition(0);
        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
        getInstrumentation().waitForIdleSync();
        assertFalse(mExpandableListView.isGroupExpanded(0));
    } 
 
    @LargeTest 
    public void testExpandOnFirstGroup() { 
        mListUtil.arrowScrollToSelectedPosition(getActivity().getNumOfHeadersAndFooters());
        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
        getInstrumentation().waitForIdleSync();
        assertTrue(mExpandableListView.isGroupExpanded(0));
    } 
} 
4
CodeRank

Related ExpandableListView isGroupExpanded Questions & Answers:

isGroupExpanded Method Overview
Whether the given group is currently expanded.
See Code Examples for other Android ExpandableListView Methods: