Example usage for android.widget WrapperListAdapter getWrappedAdapter

List of usage examples for android.widget WrapperListAdapter getWrappedAdapter

Introduction

In this page you can find the example usage for android.widget WrapperListAdapter getWrappedAdapter.

Prototype

public ListAdapter getWrappedAdapter();

Source Link

Document

Returns the adapter wrapped by this list adapter.

Usage

From source file:com.spatialnetworks.fulcrum.widget.DynamicListView.java

private void swapElements(int indexOne, int indexTwo) {
    ListAdapter listAdapter = getAdapter();
    if (listAdapter instanceof WrapperListAdapter) {
        WrapperListAdapter wrapperListAdapter = (WrapperListAdapter) listAdapter;
        listAdapter = wrapperListAdapter.getWrappedAdapter();
    }//from   w  ww .j a v  a 2 s.co  m

    if (!(listAdapter instanceof ArrayAdapter)) {
        throw new RuntimeException("DynamicListView can only swap elements using an ArrayAdapter");
    } else {
        ArrayAdapter arrayAdapter = (ArrayAdapter) listAdapter;
        Object obj2 = arrayAdapter.getItem(indexTwo);

        //noinspection unchecked
        arrayAdapter.remove(obj2);
        //noinspection unchecked
        arrayAdapter.insert(obj2, indexOne);
    }
}