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 6687711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:19:15+00:00 2026-05-26T05:19:15+00:00

I am using eclipse and learning android out of a book. I am copying

  • 0

I am using eclipse and learning android out of a book. I am copying code to learn about menus and am getting these two errors and cannot figure out why.

 @Override
public boolean onCreateOptionsMenu(Menu menu){
    menu
    .add(Menu.NONE, MENU_ADD, Menu.NONE, "Add")
    .setIcon(android.R.drawable.ic_menu_add);
    menu
    .add(Menu.NONE, MENU_RESET, Menu.NONE, "RESET")
    .setIcon(android.R.drawable.ic_menu_refresh);//error here.

This is the ic_menu_refresh cannot be resolved or is not a field error
ic_menu_refresh does not show up as one of the options ic_menu_add did.

The getting a add cannot be resolved or is not a field error

private void add(){
final View addView=getLayoutInflater().inflate(android.R.layout.add, null);//add is the source of the error.

Here are the libraries I am using

 package com.commonware.android.menus;
 import java.util.ArrayList;
 import android.app.AlertDialog;
 import android.app.ListActivity;
 import android.content.DialogInterface;
  import android.os.Bundle;
 import android.view.ContextMenu;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText; 

I can include the rest of the code if needed

  • 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-05-26T05:19:15+00:00Added an answer on May 26, 2026 at 5:19 am

    In the first case you are most likely trying to use a resource that is not a public resource in the sdk. You can always pull it from your sdk on your machine and put it inside your drawables.

    Your error in the second case is that you are using android.R instead of just R. android.R is all of the android available resources included in the sdk. When you use just R.something you are referencing your programs R class to look for your resources. Make sure if you put just R that eclipse didn’t import the actual android.R in the imports for the class. You want to import yourpackagename.R in the top of the class you are using them in.

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

Sidebar

Related Questions

I have just started learning to write apps for android using Eclipse. Where can
Forgive my ignorance - still learning here. I am using Eclipse Ganymede (Java 1.5)
Using Eclipse I want to view the source code for a core Java class
I'm using Eclipse 3.4 and have configured the Java code formatter with all of
I have recently been using junit in eclipse and I am still learning. I
I'm currently learning Java, using a combination of the Head First Java book and
I am using Eclipse Galileo. I am learning Eclipse RCP and doing some examples
I'm learning Python and Django using the Eclipse Pydev plugin. I want the internal
I am learning TDD and using CppUTest in eclipse. Is there any way to
I am trying to design an android activity layout, I am using Eclipse with

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.