Blake
Blake

Reputation: 7547

i have the mymenu.xml in res folder but when i inflate it, it says cannot be resolved or is not a field

I created the menu folder under res, and created mymenu.xml inside the folder, and I can see the reserved memory space for mymenu in R.java but it keeps prompting cannot be resolved or is not a field. What could be the problem?

public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.mymenu, menu);
    return true;

}

in the R.java

public static final class menu {
    public static final int mymenu=0x7f050000;
}

Upvotes: 0

Views: 88

Answers (2)

Sergey Metlov
Sergey Metlov

Reputation: 26291

Make sure you're using your project's R not android.R.

Upvotes: 2

Vasil Valchev
Vasil Valchev

Reputation: 5819

Have you try to rename it as menu.xml? Can you show and the .xml source?

Upvotes: 0

Related Questions