I made an XML file under my newly created res/menu folder. Menu.xml contains my menu definition for use with MenuInflater.
The entire XML file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/settings"
android:title="@string/settings_label"
android:alphabeticShortcut="@string/settings_shortcut" />
</menu>
I’m trying to run the program and the console keeps returning two problems.
- Bad XML block: no root element node found
- error: Error parsing XML: unbound prefix
I can’t seem to see what’s wrong with my XML file. Any thoughts? Am I missing something basic here?
I know the android dev docs say that MenuInflater “only works with an XmlPullParser returned from a compiled resource (R. something file.)” Doesn’t that just mean that I need to create an XML file under my res/ folder as I’ve done? Did I screw something up here? (I just created a new android xml file. put it under Res/menu and referenced it as “R.menu” when I called the inflate method.
Project > Clean is like “make clean” on Unix. It deletes all your generated files and starts from scratch. It also deletes items in your Problems window. Sometimes Eclipse gets confused and doesn’t clear the problems or rebuild properly so Project > Clean comes to the rescue.