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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:51:23+00:00 2026-05-19T21:51:23+00:00

using onSaveInstanceState(Bundle ..) and onRestoreInstanceState(Bundle ..) was really good and work, but it is

  • 0

using onSaveInstanceState(Bundle ..) and onRestoreInstanceState(Bundle ..)
was really good and work, but it is working when click Turn off button on Emulator.
Now, i want to save state and restore the saved data when below button used:
Emulator

I think it is possible to use OnPause() OR oOnStop(), if i am right, How to use it,
it will be enough to show me Java source of saving one boolean variable, and restore it,
Thanks.

  • 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-19T21:51:24+00:00Added an answer on May 19, 2026 at 9:51 pm

    I would use onPause(), as onStop() is not guaranteed to be called. See the application fundamentals for details on the lifecycle.

    To save and restore a boolean, I would use SharedPreferences. There is a code example on the data storage page that shows how to save and restore a boolean. They use onCreate() and onStop(), but I would use onResume() and onPause(), for the reasons I have already mentioned.

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

Sidebar

Related Questions

I am using onSaveInstanceState and onRestoreInstanceState to keep hold of my level data once
Using top it's easy to identify processes that are hogging memory and cpu, but
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
I am working with a UI using tabs in the ActionBar. When switching between
I started using DialogFragment, because they are working nicely through orientation changes, and stuff.
In my app when i do some long work i'm using a Progress Dialog
I am using JFreeChart ( http://www.jfree.org/jfreechart/ ) as a charting library. But for Android
I have a variable that I have successfully saved and restored using onSaveInstanceState @Override
I am using instances of two activies (A and B) among my application. Now
Using of mobile dialog authentication is working well for other mobile devices except on

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.