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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:31:00+00:00 2026-06-11T18:31:00+00:00

I am new to android development. I am working on a android app. Can

  • 0

I am new to android development. I am working on a android app.

Can anyone say me how to call a particular method in android, when an user kill or terminate my app. In other words, I need to execute a particular method first when user kills/terminate my app from their mobile. So that, the specific method will be executed first and then my app will be closed.

Any suggestions please. Thank you.

  • 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-11T18:31:01+00:00Added an answer on June 11, 2026 at 6:31 pm

    This is possible by overriding the onStop or onDestroy methods of your Activity.

    Like this:

    public class MyActivity extends Activity{
    
         //Other methods here (onCreate, and such)
    
         @Override
         public void onStop()
         {
             super.onStop();
             //Do whatever you want to do when the application stops.
         }
         @Override
         public void onDestroy()
         {
             super.onDestroy();
             //Do whatever you want to do when the application is destroyed.
         }
    
    }
    
    • onStop gets called just before the user exits the activity , or when another activity starts pushing this one in the background.
    • onDestroy gets called just before you completely finish the activity by calling Activity.Finish(), or when the system has to remove it from the memory to save space.

    For more info about the application lifecycle , see here.

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

Sidebar

Related Questions

I'm new to android game development. I currently working on a simple android app
I am working on new app development in android. I need to launch an
I'm fairly new to Android development and am working on an app which allows
I am new to android programming and development. I am working on app that
I am new to android development,now I am working on C2DM implementation for android
I'm quite new to Android development. My understanding is that you can create several
I am working on an Android app that has multiple screens the user will
I'm new to Android development and working on an Android application that requires the
I am new to android development. Currently i am working on an application which
I'm new to android development and I've been working on android through java(eclipse) till

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.