Code example for ExpandableListView

Methods: getFlatListPosition, getCount

0
    } 
     
    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()) {
                setListPositionFromTopImpl(pos, y, callback);
                return; 
            } 
        } 
        if (callback != null) callback.run();
    } 
     
    public void setListPositionFromTopImpl(final int position, final int y, final Runnable callback) {
        final ExpandableListView view = getExpandableListView();
        view.post(new Runnable() {
            @Override 
            public void run() { 
                if (view == null) return;
                view.requestFocus();