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

The Archive Base Latest Questions

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

I am new to Android Mono programming, but I have what is probably a

  • 0

I am new to Android Mono programming, but I have what is probably a simple question. Basically what I am doing is storing a String value whenever my app is exited via home or back button action. I want to restore this String value to the proper TextView field when the app is reopened. This seems simple enough, but I have yet to discover the means to do so. So far I have the string as a global variable to my Activity class, and I set it anytime an action is taken in my app where this value is changed. I have handled OnResume and OnRestart to try and repopulate the TextView but seems the life cycle of the activity causes the value of this String to be lost when the app is exited. Where or how can I store this value upon change or exit of the app, so when its resumed, the value can be restored?

  • 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-14T12:20:19+00:00Added an answer on June 14, 2026 at 12:20 pm

    use this to store the string…

            final SharedPreferences pref1 = getSharedPreferences("myapp", MODE_PRIVATE);
            SharedPreferences.Editor editor = pref1.edit();
            editor.putString("Stringval", "xxxxxxx");
            editor.commit();
    

    to get the value from SharedPreference use below code:-

        final SharedPreferences pref1 = getSharedPreferences("myapp", MODE_PRIVATE);
        String str1= pref2.getString("Stringval", null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a fairly simple Activity in Mono for Android project: [Activity(Label =
Pretty new to Mono for Android (C#), and I'm seeming to have trouble during
I'm new to Mono for Android (using MonoDevelop) and Android development in general. I
i am creating a new android application.i am using the table layout. I have
I am currently using Mono for Android to develop a mobile application. I have
I have the following problem. We have build an app with mono for android.
I am new to Mono For Android and im trying to send one typed-text
I have found that my Mono for Android app crashes on each start after
I am fairly new to Android development. I am using Mono for Android for
I developed my app using Mono for Android. I have the latest version 4.0.3.

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.