https://classroom.udacity.com/courses/ud836 fix error

from the Udacity course on Android input:
 
there is a problem because some instructions are missing for the menu XML and action_settings string setting. 
 
The following page explains the fix:
 
and is documented here for future reference in case the link disappears:

Right click on the res folder while you’re in Android Studio, hover over new, then select Android Resource Directory. It will come up with a box which will probably have Directory name & Resource type both set to ‘values’. What you want to do is click on the down arrow to the right of the Resource type box, and select ‘menu’. The Directory name will also have changed to ‘menu’. Now click the OK button. Now you have your menu folder.

Next you need to create the menu_main.xml file. Right click on the menu folder, hover over new, then click on Menu resource file. It will open a box asking for the name of the file. Type in menu_main (you don’t need to put the .xml at the end, it will do that for you.

So now you need to copy and paste this code into your new file:

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

Then to fix the actions_settings string :

Go to res/values/strings.xml and add this second string:
<resources>
    <string name="app_name">Court Counter</string>
    <string name="action_settings">Settings</string>
</resources>
done! Everything works fine at this stage so the project was uploaded to GitHub.

Leave a Reply