• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

An error happened when I Define Menus in XML.

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?


 
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can we see your actual Java code implementing the menu?
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic