• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

An error happened when I Define Menus in XML.

 
kevin saber
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have followed the instruction of the Android docs, "Dev Guide ——>User Interface ——> Creating Menus——>Define Menus in XML".
But after creating "res\menu\options_menu.xml" and run the application, the result is as follow:


*The code about options_menu.xml is :
, saving correctly!

* The console displayed some error information as :


That is
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[2010-05-10 22:06:33 - TestAndroid] Error in an XML file: aborting build.
[2010-05-10 22:06:34 - TestAndroid] W/ResourceType( 4020): Bad XML block: header size 261 or total size 17105092 is larger than data size 0
[2010-05-10 22:06:34 - TestAndroid] D:\kevin\kevinWork\TestAndroid\res\menu\options_menu.xml:1: error: Error parsing XML: no element found
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

How shoul this problem be resolved?


 
Shawn Franks
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we see your actual Java code implementing the menu?
 
Angus Rose
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I think you'll have to place your xml file containing the menu items in a directory called 'xml', and then use the following code to access it:

XmlPullParser xpp = getResources().getXml(R.xml.celldivisionmenu);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic