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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:40:10+00:00 2026-06-11T16:40:10+00:00

I am creating an Activity with android:launchMode=singleTask. In the app, there is another class,

  • 0

I am creating an Activity with android:launchMode=”singleTask”. In the app, there is another class, not declared in the activity, which keeps itself a static final instance and some journal to show in the activity.
When I try to finish the activity by press the back key. The log show the activity is destroyed, as I put

@Override
public void onDestroy() {
    super.onDestroy();
    Log.d("I am destroyed", ".");
}

code in the activity.
However, when I start the app again, I find the activity is still the same as I leave it.
Then, I press the back key, and remove it from the recent apps list manually. And run the app again. This time, the app shows as it should be.

What’s the different between press the back key to finish a app and remove it in recent apps list? And what should I do if I want to finish the app as normal apps do?

  • 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-11T16:40:12+00:00Added an answer on June 11, 2026 at 4:40 pm

    Each android application gets it’s own process, and in that process, one more more activities can start and finish many times without the process ending.

    Static variables don’t go out of scope when an Activity ends, but only when the process finally ends.

    You could end the entire process by calling System.exit(0) however that sort of thing is usually discouraged and a better solution would be to reinitialize the relevant values when the activity is destroyed.

    edit: See this post for more details about closing an Android application:

    How to close Android application?

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

Sidebar

Related Questions

So I've got an activity in my app that is currently marked as android:launchMode=singleTop
I am implementing android application which is on web service. I'm creating login Activity
I have a webview that I'm creating in an Activity which is a child
I am dynamically creating views as show below public class DynamicLayoutActivity extends Activity {
I am implementing an Android Activity from which other Activities will be derived from.
I am confirming about creating activity. My Manifest.xml is like this : <application android:icon=@drawable/icon
How to differentiate between two items in the ListView Activity(Android)?? As i am creating
Which is more appropriate to use in Screen Orientation. Declaring <activity android:screenOrientation=sensor /> or
I'm creating my first android application but it does not start at all. In
The official introduction to Text-To-Speech in Android says that upon creating your activity, a

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.