Android examples for android.widget:Adapter
get BaseAdapter from Adapter
import android.widget.Adapter; import android.widget.BaseAdapter; import android.widget.HeaderViewListAdapter; public class Main{ public static BaseAdapter getAdapter(Adapter adapter) { if (adapter == null) { return null; }//from w w w . j a v a 2 s. c om BaseAdapter baseAdapter = null; if (adapter instanceof BaseAdapter) { baseAdapter = (BaseAdapter) adapter; } else if (adapter instanceof HeaderViewListAdapter) { HeaderViewListAdapter headerViewAdapter = (HeaderViewListAdapter) adapter; if (headerViewAdapter.getWrappedAdapter() instanceof BaseAdapter) { baseAdapter = (BaseAdapter) headerViewAdapter .getWrappedAdapter(); } } return baseAdapter; } }