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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:56:02+00:00 2026-06-01T16:56:02+00:00

I have an app that records some data (time, user’s gps position etc). Now

  • 0

I have an app that records some data (time, user’s gps position etc). Now I want to implement this: when user presses back I pop an alertdialog with two options to “pause” or “exit”. I can do that overriding the onKeyDown method. Now “exit” should mean to close the app and the recording of data is stopped. “pause” should mean that the user can close the app for some minutes and then continue when he re-opens from the exactly same point.

I have done some research, but I got confused on many points:

1) Can I guarantee somehow that the activity gets paused and not destroyed? Moreover finish() destroys the activity. Is there some method to pause it programmatically?

2) If only the onPause is called then when app is opened again shouldn’t start from onResume? So all the counters (which I normally set to zero in the onCreate method) should remain in the last state?

3) One obvious way would be to save the whole state of the counters etc in the device db and then restore it when user re-opens. But it is more painful, and most of all this a good practice?

Thanks in advance for any clarification!

  • 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-01T16:56:03+00:00Added an answer on June 1, 2026 at 4:56 pm

    you Can’t guarantee that the activity never will be destroyed, cause if the system needs memory or something it will automaticaly close some apps, but you can save your state of your app in a variable “savedinstancestate” witch you can save in a persistance database, or in the SD.

    If you want to pause the app you should call the “onPause” method and then call the method “onResume” if you do this, you will be able to restart your app from the last state.

    if you want to stop your app, only call the method “onStop”

    i’m not a master of Android, but i hope that this answer could throw some light about your question 😉

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

Sidebar

Related Questions

I have an app that creates a SQLite database ( with 24 records ),
have an app that finds your GPS location successfully, but I need to be
I'm writing a silverlight app which does some real-time charting. Basically, I just have
I have some XML data retrieved from a web service that I use to
I currently have an HTML5 web app that utilizes localstorage/websql/app cache. Now that the
I am developing an app that lets the user record videos and photos. Now
I have an app that does an SQL and loads a set of data
I have a database-synchronisation task that takes some time to process, as there are
I have an app that have a lot of records that i am loading
I've been using mySQL for an app for some time, and the more data

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.