user3235155
user3235155

Reputation: 11

Remove error from main.xml file in menu

I've been getting an error in main.xml file which is in menu folder. R.java isn't generated. The error is on the last line of xml code. I have tried everything...

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
   <item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:showAsAction="never"
    android:title="@string/action_settings"/>

</menu>

Upvotes: 1

Views: 1228

Answers (3)

JackTools.Net
JackTools.Net

Reputation: 734

Cut your code from your xml-file and paste it in an normal text editor, notepad or gedit or something like this. Copy it back to your xml-file. Sometimes this helps.

Upvotes: 0

Rahul Gupta
Rahul Gupta

Reputation: 5295

Well first of all, if you know basic html, you should know that every tag has an opening tag and a closing tag. That being said, in your code, you close the item tag but you forgot to closs the menu tag :-

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
 <item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:showAsAction="never"
    android:title="@string/action_settings"/>
</menu>

Upvotes: 0

Chirag Ghori
Chirag Ghori

Reputation: 4231

Put this line in strings.xml inside /res/values directory

 <string name="action_settings">Your String Here</string>

Upvotes: 2

Related Questions