Radio buttons not being selected on SubMenu

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Radio buttons not being selected on SubMenu

Postby paulse » Sat Sep 05, 2009 12:04 am

Not quite sure what I am doing wrong, the menu appears but the menu item that gets click does become selected.

Thanks for any help

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class SubMenuTest extends Activity {
  2.  
  3.         private int SUB_MENU_GROUP = 1;
  4.  
  5.        
  6.  
  7.     /** Called when the activity is first created. */
  8.  
  9.     @Override
  10.  
  11.     public void onCreate(Bundle savedInstanceState) {
  12.  
  13.         super.onCreate(savedInstanceState);
  14.  
  15.         setContentView(R.layout.main);
  16.  
  17.     }
  18.  
  19.    
  20.  
  21.     @Override
  22.  
  23.     public boolean onCreateOptionsMenu(Menu menu) {
  24.  
  25.        
  26.  
  27.         SubMenu subMenu = menu.addSubMenu("SubMenu");
  28.  
  29.        
  30.  
  31.         subMenu.add(SUB_MENU_GROUP, 1, Menu.NONE, "Option 1").setChecked(true);
  32.  
  33.         subMenu.add(SUB_MENU_GROUP, 2, Menu.NONE, "Option 2");
  34.  
  35.         subMenu.add(SUB_MENU_GROUP, 3, Menu.NONE, "Option 3");
  36.  
  37.         subMenu.setGroupCheckable(SUB_MENU_GROUP, true, true);
  38.  
  39.        
  40.  
  41.         return super.onCreateOptionsMenu(menu);
  42.  
  43.     }
  44.  
  45. }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Attachments
SubMenu Test.zip
(24.58 KiB) Downloaded 44 times
paulse
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Sep 04, 2009 7:56 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests