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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:57:18+00:00 2026-05-29T05:57:18+00:00

I have an activity: public class Notepadv1 extends ListActivity { public static final int

  • 0

I have an activity:

public class Notepadv1 extends ListActivity {

   public static final int INSERT_ID = Menu.FIRST;
   ...
   @Override
   public boolean onCreateOptionsMenu(Menu menu) {

        boolean result = super.onCreateOptionsMenu(menu);

        menu.add(0, INSERT_ID, 0, R.string.menu_insert); //problem here

        return result;
    }
  ...
}

my res/values/strings.xml :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Notepad v1</string>
    <string name="no_notes">No Notes Yet</string>
    <string name="menu_insert">Add Item</string>
</resources>

Then, I run my application on emulator. After the app launched, When I press the “menu” button I expect to have a “Add Item” option to show up on menu, but I got error:

E/AndroidRuntime(  631): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(  631): android.content.res.Resources$NotFoundException: String resource ID #0x7f040002
E/AndroidRuntime(  631):    at android.content.res.Resources.getText(Resources.java:200)
E/AndroidRuntime(  631):    at android.content.res.Resources.getString(Resources.java:253)
E/AndroidRuntime(  631):    at com.android.internal.view.menu.MenuBuilder.add(MenuBuilder.java:397)
E/AndroidRuntime(  631):    at com.android.demo.notepad1.Notepadv1.onCreateOptionsMenu(Notepadv1.java:55)
E/AndroidRuntime(  631):    at android.app.Activity.onCreatePanelMenu(Activity.java:2123)
E/AndroidRuntime(  631):    at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:305)
E/AndroidRuntime(  631):    at com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:550)
E/AndroidRuntime(  631):    at com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:1192)
E/AndroidRuntime(  631):    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1636)
E/AndroidRuntime(  631):    at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2368)
E/AndroidRuntime(  631):    at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2338)
E/AndroidRuntime(  631):    at android.view.ViewRoot.handleMessage(ViewRoot.java:1641)
E/AndroidRuntime(  631):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  631):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  631):    at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime(  631):    at java.lang.reflect.Method.invokeNative(Native Method)
...

It seems the android runtime can not recogonize my “menu_insert” vaue defined in res/values/strings.xml , why? where am I wrong?

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

    Cleaning your project (Project -> Clean) might help.

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

Sidebar

Related Questions

If I have defined a Activity: public class DialogActivity extends Activity{ @Override public void
I have this structure: 1) main activity: public class mainActivity extends Activity { @Override
I have the activity: public class Mtest extends Activity { Button b1; Button b2;
I have an android activity in which I'm using tabs. public class UnitActivity extends
I have a async task called within an activity: public class DownloadFile extends AsyncTask<String,
If i have my class as import java.io.File; import java.io.FileOutputStream; //Extends Activity public class
In the main class of my project, I have public class MyClass extends Activity{
I have this code(class in class) in java (andorid) public class History extends Activity
I have a list of objects called Activity: class Activity { public Date activityDate;
I've got the following method... public class Image extends Activity { public void onCreate(Bundle

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.