Reputation: 403
I am following exact steps of an online tutorial, I checked every other places, this gives me no errors, however, when it comes to this activity, instead of a menu, it gives me a blank white page. Would you please help me here to figure out what's the problem?! Thanks. :)
public class Menu extends ListActivity{
String classes[] = { "startingPoint", "example1", "example2"
, "example3", "example4", "example5", "example6"};
@Override
public void onCreate(Bundle savedInstanceState,
PersistableBundle persistentState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(Menu.this, android.R.layout.simple_list_item_1, classes));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String cheese = classes[position];
try{
Class ourClass = Class.forName("com.thenewboston.travis." + cheese);
Intent ourIntent = new Intent(Menu.this,ourClass);
startActivity(ourIntent);
} catch (ClassNotFoundException e){
e.printStackTrace();
}
}
Upvotes: 0
Views: 68
Reputation: 152817
The overload onCreate(Bundle,PersistableBundle)
is only for API level 21 and up. For pre-21, you need onCreate(Bundle)
.
Change the signature from
@Override
public void onCreate(Bundle savedInstanceState,
PersistableBundle persistentState) {
to
@Override
public void onCreate(Bundle savedInstanceState) {
Upvotes: 1