I keep getting "Your content must have a ListView whose id attribute is 'android.R.id.list'" I read some answers and they say you should use ListView list = getListView; Which I do and also I am using android:id="@android:id/list" for my list view yet my application keeps crashing when I try to have it open/launch an activity after each list view item is clicked?
<ListView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_marginTop="149dp"
android:id="@android:id/list"
/>
ListView listView = getListView(); // hear bind your listview
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_selectable_list_item,getResources()
.getStringArray(R.array.countries)));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> listView, View itemView, int itemPosition, long itemId)
{
//keeps crashing when trying to open Second activity
Intent intent = new Intent(getApplicationContext(), SecondActivity.class);
startActivity(intent);
}
});