Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
Developer
Posts: 80
Registered: ‎11-25-2010
My Device: 9700
My Carrier: Rogers

run code when user exits application?

Is there a method I can override which runs when the user exits the Android runtime? (ie: by swiping the application off the screen)

 

I need to save the user's work before the application is closed.

 

I have tried finalize(), onTerminate(), and onDetatchedFromWindow(), but nothing seems to work.

 

Thank you!

__________________________________________________
If my post helped you, make sure to give me kudos by clicking the star below my name! Smiley Happy
Highlighted
Contributor
Posts: 46
Registered: ‎02-15-2012
My Device: BB Playbook
My Carrier: Verizon Wireless

Re: run code when user exits application?

[ Edited ]

Have you tried onDestroy( ) or onStop( ) ?

New Developer
Posts: 10
Registered: ‎11-28-2012
My Device: Blackberry Playbook
My Carrier: Wifi

Re: run code when user exits application?

Swiping the application off the screen?
Have a look at the official Android developer reference.

http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

In your case you should try onStop or onDestroy.