0

I'm creating an Android App,
in this app i have to cancel some data when the app is closing, how i can do that?

There is some event like onDestroy?

3
  • 2
    ya, onDestroy() , onPause() and onStop() methods are there, check this developer.android.com/reference/android/app/Activity.html
    – Charan Pai
    Commented Jun 18, 2013 at 9:49
  • no, the application class has no callback for "when the app closes". That said on the android platform an app is pushed to the background e.g. when you hit the home button or get a phone call. You'd have to use workarounds to reset your variables "on app closing". (P.S. the notion of an app closing doesn't exist on android)
    – Suau
    Commented Jun 18, 2013 at 9:58
  • Ok, Thank you! So i could make a splash screen that appear when the app i opening, and during the splash screen i can cancel my data. I think that this way can be right!
    – Garumbo
    Commented Jun 18, 2013 at 12:30

1 Answer 1

1

You can try override onBackPressed on your first activity it wont be a complete solutions though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.