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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:57:51+00:00 2026-05-14T06:57:51+00:00

So within my application is a form for creating a new user, with relevant

  • 0

So within my application is a form for creating a new user, with relevant details and information about the user. There’s no problems there, it’s just what happens when the user leaves the activity without pressing the confirm button.

Here’s what I want to do:

  1. If the user presses the back button, attempt to save all the data to the database and inform the user.
  2. If the activity is interrupted (ie by a phone call), save all the data into a temporary location so when the activity is at the top of the stack again, nothing appears to have changed (but the data still hasn’t yet been saved to the database).
  3. If the activity gets killed for more resources when in the background, do the same as point 2 above (ie when the activity is started again, it appears that nothing has changed).
  4. If the whole application is started again (by clicking on the icon again) and there is temporary data stored from either points 2 or 3 above, navigate to the “create user” activity and display data as if nothings changed.

Here’s how I’m currently trying to do it:

  • Use onDestroy() and isFinishing() functions to find when the activity is being killed, to cover point 1 above (to then try and save all data).
  • Save all data with onSaveInstanceState into a bundle (to cover point 2 above)
  • Does the bundle created with onSaveInstanceState survive the activity being killed for more resources, so when its recreated the previous state can be retrieved (as in point 3 above)?
  • No idea how to implement point 4.

Any help would be massively appreciated.

Cheers!

  • 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-14T06:57:52+00:00Added an answer on May 14, 2026 at 6:57 am

    I’m short on time so can’t give a full detailed answer, but in brief, here are my suggestions.

    • Instead of using onDestroy(), use onPause(). That’s guaranteed to get called; according to the official documentation on Lifecycles, only onPause() is guaranteed. onStop and onDestroy are not.
    • onSaveInstanceState and onPause are similar. Both get called when the app leaves the foreground (i.e. it enters the potential danger zone for being killed), but the difference with oSIS is the temporary bundle it provides. onPause doesn’t provide any data storage mechanism, but if you’re using a database than you already have one. According to the documentation, there isn’t a guaranteed order to which one gets called first.
    • Point 3) That’s exactly what oSIS is meant for
    • Point 4) You could make a ‘temporary row’ in your database, i.e. save temporary data to row 1, but whenever a save is properly made, row 1 gets blanked. Then in your onCreate(), check whether row 1 has real data or is empty. (If your columns can’t be empty, then use pre-determined placeholder values that wouldn’t ever appear as part of normal use.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a simple contact form within my ZF application. It doesn't feel like
I am creating an ASP.NET application that allows the user to add form elements
I have a form within an ASP.NET MVC application and I'm trying to submit
I have a complex input form within a PHP based web application. To structure
In my application, each thread handle a Form, and its events shall executed within
My application is a C# Windows form application. When the user presses the button
For practicing purposes, I’m about to create a new ASP.NET MVC 3.0 application. My
I am creating a simple Windows form through Visual Studio->Visual c++->MFC->MFC Application. It only
When creating an instance of a button within a .NET WinForms application, the .CausesValidation
I am building a small windows form application in C#. Within the form code

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.