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

  • Home
  • SEARCH
  • 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 8639711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:05:26+00:00 2026-06-12T11:05:26+00:00

I am using the following code to store data in shared pref. However when

  • 0

I am using the following code to store data in shared pref.
However when ever this code is called , the virtual device tells me that the application
stopped responding. Any suggestions why this is happening ?

SharedPreferences spref =       this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = spref.edit();
editor.putString("td", "SharedPref"); //name-value pair
editor.commit();

Edit:
Now I am using the following

SharedPreferences spref = this.getSharedPreferences(“myPrefs”, MODE_WORLD_READABLE);
SharedPreferences.Editor editor = spref.edit();
editor.putString(“td”, “SharedPref”);
editor.commit();

But I am still Getting “The application has stopped unexpectedly..Please Try Again”

Looks like there was some problem with the virtual device. After recreating it my app started working fine.

  • 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-12T11:05:27+00:00Added an answer on June 12, 2026 at 11:05 am

    In my apps i prefer using my own location names. Declare

    public static final String PREFS_NAME = "MyPrefsFile";
    

    then in the code

    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);  //0 might be bad naming, can just use MODE_PRIVATE or something instead depending on what you need to do :)
    SharedPreferences.Editor editor = settings.edit();
    editor.putInt("key", "value");
    editor.commit();
    

    shouldn’t be any problems with this if the info you’re saving is correct

    EDIT

    you also need to update your manifest with the following:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code: var genres1 = new Ext.data.Store({ reader: new Ext.data.JsonReader({ fields:
I am using the following code: if (store.getItem('TopicID') != 00) TopidID is always 4
I am using the following code to store values in aspx session. Code: $(div.menu_body
I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I am using the following tcl code to store a file from my deskstop
I'm using the following code to create a file and write data into it:
I am trying to store data into database. if i am using the following
I store data using the following method - (NSManagedObject *) createCourseWithCourseCode:(NSString *) courseCode {
In LibGdx, texture image is stored in asset folder and loaded using following code.
I am using the following code to connect to an Oracle stored procedure, 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.