// Activity callback that lets your handle the selection in the class. // Return true to indicate that you've got it, false to indicate // that it should be handled by a declared handler object for that // item (handler objects are discouraged for reasons of efficiency). @Override public boolean onOptionsItemSelected(Menu.Item item){ switch (item.getId()) { case 0: //setContentView(R.layout.login); onRestart(); //showAlert("Menu Item Clicked", "File", "ok", null, false, null); return true; case 1: showAlert("Menu Item Clicked", "Edit", "ok", null, false, null); return true; case 2: showAlert("Menu Item Clicked", "View", "ok", null, false, null); return true; case 3: showAlert("Menu Item Clicked", "WWW", "ok", null, false, null); // WebView webView = new WebView(this); // webView.loadUrl("http://www.google.com"); // webView.setFocusable(true); return true; case 5: showAlert("Sub Menu Item Clicked", "Monday", "ok", null, false, null); return true; case 13: showAlert("Sub Menu Item Clicked", "Rajkumar", "ok", null, false, null); return true; case 14: showAlert("Sub Menu Item Clicked", "Arun", "ok", null, false, null); return true; } return false; } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // title menu.add(0, 0, "Back"); menu.add(0, 1, "Edit"); // Add our submenu. SubMenu sub = menu.addSubMenu(1, 4, "Days of the week"); sub.add(0, 5, "Monday"); sub.add(0, 6, "Tuesday"); sub.add(0, 7, "Wednesday"); sub.add(0, 8, "Thursday"); sub.add(0, 9, "Friday"); sub.add(0, 10, "Saturday"); sub.add(0, 11, "Sunday"); SubMenu sub1 = menu.addSubMenu(2, 12, "Friends"); sub1.add(0, 13, "Rajkumar"); sub1.add(0, 14, "Arun"); return true; }
On Jun 11, 12:13 am, "pravin gajera" <[EMAIL PROTECTED]> wrote: > Hello Friends > my Q. is how to create menu in android system --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---