how link menu to new page in android -


this code, crashes:

public boolean oncreateoptionsmenu(menu menu) {      submenu sub = menu.addsubmenu(0, 1, 1, "register");     sub.add(0, 3, 1, "register book");     sub.add(0, 4, 2, "register new book");     menu.add(0, 2, 2, "report");     return super.oncreateoptionsmenu(menu);  }  public boolean onoptionsitemselected(menuitem item) {      switch (item.getitemid()){          case 4:                 intent intent = new intent(bookactivity.this, newbookactivity.class);                 bookactivity.this.startactivity(intent);                 break;          return super.onoptionsitemselected(item);     } } 


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -