码迷,mamicode.com
首页 > 移动开发 > 详细

android基类Adapter

时间:2015-10-22 17:14:26      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:

import android.content.Context;
import android.widget.BaseAdapter;
import java.util.List;

/**
 * 基类Adapter
 * Created by Administrator on 2015/10/22 0022.
 */
public abstract class MyBaseAdapter<T> extends BaseAdapter {

    protected Context mContext;
    public List<T> datas;

    public MyBaseAdapter(BaseActivity context,List<T> list) {
        super();
        mContext = context;
        datas = list;
    }

    public MyBaseAdapter(BaseActivity context) {
        super();
        mContext = context;
    }

    @Override
    public int getCount() {
        try {
            return datas.size();
        } catch (Exception e) {
        }
        return 0;
    }

    @Override
    public Object getItem(int position) {
        return datas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

}

 

android基类Adapter

标签:

原文地址:http://www.cnblogs.com/kangweifeng/p/4901265.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!