Create group menus

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

Create group menus

Postby Helios » Wed Jan 21, 2009 6:01 pm

Hi every one, I am novice in Android and I have been trying to create a group menu as the one in the API DEMOS. To do so I have been looking to the code in the Android's site which you can see in the following link :

http://code.google.com/intl/es-AR/andro ... omXml.html

In particular I don't understand how this method works :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.     @Override
  3.  
  4.     public boolean onCreateOptionsMenu(Menu menu) {
  5.  
  6.         // Hold on to this
  7.  
  8.         mMenu = menu;
  9.  
  10.  
  11.  
  12.         // Inflate the currently selected menu XML resource.
  13.  
  14.         MenuInflater inflater = getMenuInflater();
  15.  
  16.         inflater.inflate(sMenuExampleResources[mSpinner.getSelectedItemPosition()], menu);
  17.  
  18.  
  19.  
  20.         // Disable the spinner since we've already created the menu and the user
  21.  
  22.         // can no longer pick a different menu XML.
  23.  
  24.         mSpinner.setEnabled(false);
  25.  
  26.  
  27.  
  28.         // Change instructions
  29.  
  30.         mInstructionsText.setText(getResources().getString(
  31.  
  32.                 R.string.menu_from_xml_instructions_go_back));
  33.  
  34.  
  35.  
  36.         return true;
  37.  
  38.     }
  39.  
  40.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


How should be the XML file so that this code work, or to create a group menu? I will be very grateful if some one could help me. Thanks in advance!

Regards,
Helios
Helios
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sat Jan 17, 2009 7:11 am

Top

Postby Helios » Wed Jan 21, 2009 9:31 pm

Sorry to all, I did not noticed the subdirectory folder in the android's page but I have now.
Regards,
Helios
Helios
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sat Jan 17, 2009 7:11 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 14 guests