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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:19:53+00:00 2026-06-18T10:19:53+00:00

I was wondering, when is the suitable time to save our application settings to

  • 0

I was wondering, when is the suitable time to save our application settings to SharedPreferences. Should we do it during onStop, or onDestroy? I realize both methods have their pros and cons.

onStop

If user intention is not quitting the application, save application settings to SharedPreferences just seem to be redundant. He merely press home (onStop called) -> long press home -> relaunch application by select the application again

onDestroy

User can kill the application by press home (onStop called) -> long press home -> swipe left on the application to kill it. If user quit the application by that way, I realize onDestroy is not being called although the app is killed. Hence, application settings is not being saved.

So, is it better to save the application settings, during onStop or onDestroy?

  • 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-18T10:19:54+00:00Added an answer on June 18, 2026 at 10:19 am

    It is best to call commit() either right after you’ve made the changes, or in the onPause() method. This ensures that your changes are saved in pretty much every scenario, except uncaught exceptions that crash your app.

    Also, you should note that neither onStop() or onDestroy() are guaranteed to be called at all, particularly in situations when Android is low on memory. However, onPause() is almost always called.

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

Sidebar

Related Questions

I am wondering why the following is marked as an error with no suitable
Hey, I'm just wondering if there's any easy function to make text suitable to
The title says most of it, I'm wondering if MySQL is suitable, (and if
I was wondering if there is a suitable algorithm for maintaining the balance of
Whilst implementing my first MVVM application in WPF, I've been wondering about the pros
I have an assignment problem at hand and am wondering how suitable it would
I have not submitted an application yet, however am wondering if you guys could
I am wondering if there are specific cases where GWT is not suitable? For
I'm wondering, which css framework is best suitable for ASP.NET MVC 3? I've tried
I am developing a rich client web application and wondering whether which framework would

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.