@Test public void shouldShowAListOfNames() throws Exception { activity.onCreate(null); ListView namesListView = (ListView) activity.findViewById(R.id.names_list); TextView nameRow = (TextView) namesListView.getChildAt(1); assertThat(nameRow.getText().toString(), equalTo("Donald Rumsfeld")); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.names_list_layout); List<String> names = new ArrayList<String>(); names.add("Dick Cheney"); names.add("Donald Rumsfeld"); names.add("John Ashcroft"); names.add("Karl Rove"); names.add("Tom Ridge"); names.add("Justin Bieber"); names.add("Lindsey Lohan"); names.add("Sponge Bob Square Pants"); names.add("Kai Lan"); names.add("Sheriff Woody"); names.add("Slinky Dog"); ((ListView) findViewById(R.id.names_list)).setAdapter(new NamesAdapter(names)); }
NamesActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.names_list_layout); List<String> names = new ArrayList<String>(); names.add("Dick Cheney"); names.add("Donald Rumsfeld"); names.add("John Ashcroft"); names.add("Karl Rove"); names.add("Tom Ridge"); names.add("Justin Bieber"); names.add("Lindsey Lohan"); names.add("Sponge Bob Square Pants"); names.add("Kai Lan"); names.add("Sheriff Woody"); names.add("Slinky Dog"); ((ListView) findViewById(R.id.names_list)).setAdapter(new NamesAdapter(names)); } }
NamesActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.names_list_layout); List<String> names = new ArrayList<String>(); names.add("Dick Cheney"); names.add("Donald Rumsfeld"); names.add("John Ashcroft"); names.add("Karl Rove"); names.add("Tom Ridge"); names.add("Justin Bieber"); names.add("Lindsey Lohan"); names.add("Sponge Bob Square Pants"); names.add("Kai Lan"); names.add("Sheriff Woody"); names.add("Slinky Dog"); ((ListView) findViewById(R.id.names_list)).setAdapter(new NamesAdapter(names)); }  }
NamesActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.names_list_layout); List<String> names = new ArrayList<String>(); names.add("Dick Cheney"); names.add("Donald Rumsfeld"); names.add("John Ashcroft"); names.add("Karl Rove"); names.add("Tom Ridge"); names.add("Justin Bieber"); names.add("Lindsey Lohan"); names.add("Sponge Bob Square Pants"); names.add("Kai Lan"); names.add("Sheriff Woody"); names.add("Slinky Dog"); ((ListView) findViewById(R.id.names_list)).setAdapter(new NamesAdapter(names)); }   }
NamesActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.names_list_layout); List<String> names = new ArrayList<String>(); names.add("Dick Cheney"); names.add("Donald Rumsfeld"); names.add("John Ashcroft"); names.add("Karl Rove"); names.add("Tom Ridge"); names.add("Justin Bieber"); names.add("Lindsey Lohan"); names.add("Sponge Bob Square Pants"); names.add("Kai Lan"); names.add("Sheriff Woody"); names.add("Slinky Dog"); ((ListView) findViewById(R.id.names_list)).setAdapter(new NamesAdapter(names)); }    }