• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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);
 
I'm so happy! And I wish to make this tiny ad happy too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic