-1

I am in the process of trying to add a main menu to my app.

From the google docs:

To define the menu, create an XML file inside your project's res/menu/ directory and build the menu with the following elements:

I created a "menu" file in the /res folder. However it didn't appear even though trying to create a new "menu" folder resulted in an error, meaning it exists but does not appear in "android" view. So according to this answer I changed to packages view to see my newly created menu directory.

I tried to create a new resource file in my menu directory. Then this happens:

enter image description here

I am currently stuck.

Bar Akiva
  • 1,089
  • 1
  • 11
  • 23

2 Answers2

0

change to android view then right click res folder -> select new android resource file. see screenshot then window will show, select "Resource Type" to MENU and input file name then it will automatically create the parent MENU folder and menu resource file. see screenshot

pastillas
  • 124
  • 11
  • 2
    you get this error because menu folder filename must be "menu" not "Menu or menus etc" – pastillas Mar 10 '18 at 08:47
  • I did what you did, and I still get "incorrect directory". https://imgur.com/a/l2gqu – Bar Akiva Mar 10 '18 at 08:56
  • 2
    I fixed the error myself. The folder filename was "menu" but it was "Values" type and not "menu" type. Created a new "menu" type directory and it worked! Shall I add it as an edit or answer it myself? – Bar Akiva Mar 10 '18 at 14:37
  • 1
    nicee! you can add it as an answer for easy lookup.. :) – pastillas Mar 11 '18 at 03:12
0

the menu that you haved created under res should start with capital letter. menu not Menu