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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:50:05+00:00 2026-06-13T16:50:05+00:00

I keep Getting the Default value either my UI will display null or if

  • 0

I keep Getting the Default value either my UI will display null or if I use integers it displays that default value as well here it is in the string form plz help

//putting the information in shared preferences
TextView pScore1=(TextView)findViewById(R.id.pScore1f);


SharedPreferences peepsScores2= PreferenceManager.getDefaultSharedPreferences(GamePlayFirst.this);
SharedPreferences.Editor editor2 =peepsScores2.edit();
String userScore11 = pScore1.getText().toString();
  editor2.putString("userScore11",userScore11);
  editor2.commit();

  //getting it and editing it

  SharedPreferences peepsScores2 = PreferenceManager.getDefaultSharedPreferences(this);
    int u;
    int one =1;
    int newUsrScore1=1;
    String userScore11 = peepsScores2.getString("userScore11",null);
    u=Integer.parseInt(userScore11);
        newUsrScore1 = u+one;
        String newUserScore1  = Integer.toString(newUsrScore1);

    SharedPreferences.Editor editor = peepsScores2.edit();
    editor.putString(newUserScore1, NewUserScore1);
      editor.commit();

    //getting it and displaying it on the UI

    SharedPreferences peepsScores2 = PreferenceManager.getDefaultSharedPreferences(this);
    String userScore11 = peepsScores2.getString("NewuserScore1",null);


  pScore1.setText(" "+userScore11);
  • 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-13T16:50:07+00:00Added an answer on June 13, 2026 at 4:50 pm

    I have added some comment to you code please check:

    //putting the information in shared preferences
    TextView pScore1=(TextView)findViewById(R.id.pScore1f);
    
    
    SharedPreferences peepsScores2= 
    
    PreferenceManager.getDefaultSharedPreferences(GamePlayFirst.this);
    SharedPreferences.Editor editor2 =peepsScores2.edit();
    String userScore11 = pScore1.getText().toString();
      editor2.putString("userScore11",userScore11);
      editor2.commit();
    
      //getting it and editing it
    
      SharedPreferences peepsScores2 = PreferenceManager.getDefaultSharedPreferences(this);
        int u;
        int one =1;
        int newUsrScore1=1;
        String userScore11 = peepsScores2.getString("userScore11",null);
        u=Integer.parseInt(userScore11);
            newUsrScore1 = u+one;
            String newUserScore1  = Integer.toString(newUsrScore1);
    
        SharedPreferences.Editor editor = peepsScores2.edit();
    
         //@Praful: here newUserScore1 seems to be integer value and you are storing 
        //null here. I think it it should be 
        //`editor.putString("NewuserScore1", newUsrScore1);`
        editor.putString(newUserScore1, null);
    
         //@Praful: call commit here
        editor.commit;
    
        //getting it and displaying it on the UI
    
        SharedPreferences peepsScores2 = PreferenceManager.getDefaultSharedPreferences(this);
        String userScore11 = peepsScores2.getString("NewuserScore1",null);
    
    
      pScore1.setText(" "+userScore11);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting an error saying that @android:style/Widget.Holo.Light.Button.Borderless is not public and so can't
I keep getting a Run Time error that says I am having an Exception
Trying to compile a Web Project here but I keep on getting package does
I am currently having trouble getting a value from an AsyncTask that gets data
So I don't know why I keep getting this error. Here's the relevant code:
I keep getting the feeling that I'm benefitting from maybe half of the features
Hi i have program here that accept int as value. i wanted to translate
Keep getting this error after inserting a subdatasheet into a query and trying to
Keep getting the error Arguments are not sufficiently instantiated for the multiplication by addition
I keep getting this error and have no idea why. I googled and scanned

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.