Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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;
        }

        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;
    }
}