Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8394293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:01:20+00:00 2026-06-09T20:01:20+00:00

I am attempting to build my first app using the tutorial provided by android

  • 0

I am attempting to build my first app using the tutorial provided by android in Eclipse.

I’ve done everything is says but i get the error message…”menu cannot be resolved or is not a field”. The tutorial doesn’t mention anything about a menu and i’m sure i haven’t done anything to it. The line it is complaining about i’ve marked in a comment.

package com.example.my.first.app;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);        <!--this line-->
    return true;
}
}

This is the main activity page the tutorial has asked me to edit is shown below…

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText android:id="@+id/edit_message"
    android:layout_weight="1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message" />
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send" />
</LinearLayout>

Going off advice i’ve found on other questions i’ve attempted clicking on it and to include what ever it’s asking for which is “Create field ‘menu’ in type ‘R’ or “Create constant ‘menu’ in type ‘R’. I’ve done both separately and every time i save the project so it rebuilds, it automatically deletes the line that was included.

For the field, this was done. – public static Object menu;
For the constant, this was done. – public static final String menu = null;

So i’m now a little stuck and would like some much needed help please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:01:22+00:00Added an answer on June 9, 2026 at 8:01 pm

    The onCreateOptionsMenu method refers to a menu that has to be in /res/menu folder and is implemented as XML. Looks like this:

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

    You can copy/ paste this code, save it as activity_main.xml in your /res/menu folder (create one if you dont have one) or just delete the whole method

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);        <!--this line-->
        return true;
    }
    

    What this does is open a menu when you hit the menu button on the device, if you delete the method, you wont have such a menu. You can still create one if you need one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to build my first universal iOS app using the default Xcode templates
I'm attempting to build an app using the Sencha Touch 2 builder tools. I
I am new to Xcode, attempting to build my first iPad app. I need
I'm attempting to convert my GWT app to build with maven. The first issue
Attempting to build a C# NPAPI plugin I have found a tutorial which describes
I'm attempting to build a JSF/Hibernate application using Java 7 and Tomcat 7. I
I am attempting to build a Java web project on NetBeans 6.8, but I
I am attempting to build an ASP.NET MVC 4 web app, which is similar
I am attempting to build a database for inventory control using a large number
I'm not sure if I'm using classes correctly. I'm attempting to build a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.