1package com.xtremelabs.robolectric.shadows;
2
3import android.view.View;
4import android.view.ViewGroup;
5import android.widget.BaseAdapter;
6import android.widget.TextView;
7
8class CountingAdapter extends BaseAdapter {
9    private int itemCount;
10
11    public CountingAdapter(int itemCount) {
12        this.itemCount = itemCount;
13    }
14
15    public void setCount(int itemCount) {
16    	this.itemCount = itemCount;
17    	notifyDataSetChanged();
18    }
19
20    @Override
21    public int getCount() {
22        return itemCount;
23    }
24
25    @Override
26    public Object getItem(int position) {
27        return null;
28    }
29
30    @Override
31    public long getItemId(int position) {
32        return 0;
33    }
34
35    @Override
36    public View getView(int position, View convertView, ViewGroup parent) {
37        TextView textView = new TextView(null);
38        textView.setText("Item " + position);
39        return textView;
40    }
41}
42