@Test public void getView_shouldCallThroughToGetView() throws Exception { View convertView = new View(null); ViewGroup parent = new LinearLayout(null); adapter.getView(1, convertView, parent); assertThat(adapter.item, equalTo("two")); assertThat(adapter.recycleView, sameInstance(convertView)); assertThat(adapter.parent, sameInstance(parent)); }
@Override public View getView(int position, View convertView, ViewGroup parent) { return getView(getItem(position), convertView, parent); }
GenericAdapter extends BaseAdapter { @Override public View getView(int position, View convertView, ViewGroup parent) { return getView(getItem(position), convertView, parent); } }
GenericAdapter extends BaseAdapter { @Override public View getView(int position, View convertView, ViewGroup parent) { return getView(getItem(position), convertView, parent); } GenericAdapter(List<T> list); }
GenericAdapter extends BaseAdapter { @Override public View getView(int position, View convertView, ViewGroup parent) { return getView(getItem(position), convertView, parent); } GenericAdapter(List<T> list); @Override int getCount(); @Override T getItem(int i); @Override long getItemId(int i); @Override View getView(int position, View convertView, ViewGroup parent); abstract View getView(T item, View recycleView, ViewGroup parent); }
GenericAdapter extends BaseAdapter { @Override public View getView(int position, View convertView, ViewGroup parent) { return getView(getItem(position), convertView, parent); } GenericAdapter(List<T> list); @Override int getCount(); @Override T getItem(int i); @Override long getItemId(int i); @Override View getView(int position, View convertView, ViewGroup parent); abstract View getView(T item, View recycleView, ViewGroup parent);  }