list = (ListView) findViewById( R.id.simple_list );
String[] planets = new String[] { "Mercury", "Venus", "Earth", "Mars",
"Jupiter", "Saturn", "Uranus", "Neptune"};
ArrayList<String> planetList = new ArrayList<String>();
planetList.addAll( Arrays.asList(planets) );
// Create ArrayAdapter using the planet list.
listAdapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.food_menu, planetList);
// Set the ArrayAdapter as the ListView's adapter.
list.setAdapter( listAdapter );
错误在底线 它说
java.lang.RuntimeException:无法启动活动 ComponentInfo {} com.example.grantjones20.restaurant/com.example.grantjones20.restaurant.MainActivity: java.lang.NullPointerException:尝试调用虚方法&#39; void android.widget.ListView.setAdapter(android.widget.ListAdapter)&#39;在...上 null对象引用