ExpandableListView getExpandableListPosition - 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 getExpandableListPosition method.

This code example shows how to use the following methods:getChildAt, getExpandableListPosition, getFirstVisiblePosition
     
    public PositionData getCurrentPosition() { 
        ExpandableListView view = getExpandableListView();
        if (view == null) return new PositionData(0, 0);
         
        long packed_pos = view.getExpandableListPosition(view.getFirstVisiblePosition());
        View top_view = view.getChildAt(0);
        int y = top_view != null ? top_view.getTop() : 0;
        return new PositionData(packed_pos, y);
    } 
     
    public void setListPositionFromTop(final long packed_pos, final int y, final Runnable callback) {
        setListPositionFromTopImpl(packed_pos, y, callback);
    } 
     
    public void setListPositionFromTopImpl(final long packed_pos, final int y, final Runnable callback) {
        ExpandableListView view = getExpandableListView();
        if (view != null) {
            int pos = view.getFlatListPosition(packed_pos);
            if (0 <= pos || pos < view.getCount()) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getChildAt, pointToPosition, getExpandableListPosition, isGroupExpanded, getFirstVisiblePosition
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related ExpandableListView getExpandableListPosition Questions & Answers:

getExpandableListPosition Method Overview
Converts a flat list position (the raw position of an item (child or group) in the list) to a group and/or child position (represented in a packed position).
See Code Examples for other Android ExpandableListView Methods: