1

i want to make maps. when i will try for first i have problem. this is my problem.

this my code

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}    

in this code, i have problem

getMenuInflater().inflate(R.menu.main, menu);

the comment is main cannot be resolved or is not a field

Luciano Rodríguez
  • 2,239
  • 3
  • 19
  • 32
yuni khoirunnisa
  • 11
  • 1
  • 1
  • 2

2 Answers2

1

You should have a menu.xml file in your res/menu folder (if you don't have any, make it), with a content like this:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/action_settings"
        android:title="YOUR_MENU_ITEM"
        app:showAsAction="never"/>
</menu>
0

I faced same issue Just check your import for R. In my case it was.

import android.R;

Change it to

import your.application.packagename.R;

Yogesh Srivastava
  • 311
  • 1
  • 4
  • 8