I've followed this tutorial but when I try to run the application I get Unfortunately HelloListView has stopped
The IDE gives no warnings or errors.
My HelloViewListActivity.java looks like this:
public class HelloListViewActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] countries = getResources().getStringArray(R.array.countries_array);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, countries));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(),
((TextView) view).getText(), Toast.LENGTH_SHORT).show();
}
});
}
}
My strings.xml and list_item.xml are both identical to the tutorial.
Logcat log here What is it that I am doing wrong?