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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:42:24+00:00 2026-06-17T12:42:24+00:00

So for an application I am developing, I want to use sharedpreferences to save

  • 0

So for an application I am developing, I want to use sharedpreferences to save data, in this case I want to save wich languege the user chooses. This is done by A number, it will save this but when I try to work with this value on my menu page it crashes all the time

super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_menu);
    Button button1 = (Button) findViewById(R.id.button1);
    Button button2 = (Button) findViewById(R.id.button2);
    Button button3 = (Button) findViewById(R.id.button3);
    Button button4 = (Button) findViewById(R.id.button4);
    Button button5 = (Button) findViewById(R.id.button5);
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    int taal=sp.getInt("taal", 4);
    if(taal==1){
        String tekst="Nieuw Spel";
        button1.setText(tekst);
        //button1.setText("Nieuw Spel");
        //button2.setText("Statestieken");
        //button3.setText("Opties");
        //Languege.MenuText(button1, button2, button3, taal);
        button1.setText(taal);
        button4.setVisibility(Button.GONE);
        button5.setVisibility(Button.GONE);
    }

And this comes back for the error butt I really don’t find where I’m doing something wrong

01-20 16:11:05.535: E/AndroidRuntime(4308): FATAL EXCEPTION: main
01-20 16:11:05.535: E/AndroidRuntime(4308): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.stevedc.thinklogic/com.stevedc.thinklogic.MainMenu}: android.content.res.Resources$NotFoundException: String resource ID #0x1
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.os.Looper.loop(Looper.java:137)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.ActivityThread.main(ActivityThread.java:4441)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at java.lang.reflect.Method.invokeNative(Native Method)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at java.lang.reflect.Method.invoke(Method.java:511)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at dalvik.system.NativeStart.main(Native Method)
01-20 16:11:05.535: E/AndroidRuntime(4308): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x1
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.content.res.Resources.getText(Resources.java:247)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.widget.TextView.setText(TextView.java:3495)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at com.stevedc.thinklogic.MainMenu.onCreate(MainMenu.java:33)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.Activity.performCreate(Activity.java:4465)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-20 16:11:05.535: E/AndroidRuntime(4308):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
  • 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-17T12:42:26+00:00Added an answer on June 17, 2026 at 12:42 pm

    Change

    button1.setText(taal);
    

    So it is

    button1.setText(String.valueOf(taal));
    

    By passing an integer (taal), Android attempts to find a resource id and fails.

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

Sidebar

Related Questions

I am developing a java application and I want to use: Reporting Analysis Data
I am developing an application in which I want to use push notification service.
I'm developing a web application I want to use the role authentication to control
I am developing one web application. In that i want to use variable's value
I'm developing an XBAP application in C# and want to be able to use
I am developing android application and want to use twitter log in and import
I am developing a mvc application in VS 2012 so I want use MVC
When I am developing an Android Application ,I want to use a method of
I am developing an ASP.NET MVC application and I want to use OpenId. What
I am developing an application in which I want to use an NSDictionary .

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.