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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:42:41+00:00 2026-06-09T03:42:41+00:00

I have There Activities(A,B,C) within my Application.When i start the Application Activity A: A:onCreate()

  • 0

I have There Activities(A,B,C) within my Application.When i start the Application
Activity A:

  A:onCreate()
  A:onStart()
  A:onResume()

Using intent i am calling Second Activity(A -> B):

  A:onPause()
  B:onCreate()
  B:onStart()
  B:onResume()
  A:onStop()

Then I click the “Home” button So the App goes to background:Now

  B:onPause()
  B:onStop()

After 1 or 2 hour later Again i go to home page within my device and Click the App icon it runs like:

 B:onDestroy()
 A:onRestart()
 A:onStart()
 A:onResume()

But i need to go which one Activity i quit like this,

B:onRestart()
B:onStart()
B:onResume()

I have read some articles it says like that activity killed by the system because of no longer visible.Is there any possible to fix my issue…

Thanks in advance…

  • 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-09T03:42:42+00:00Added an answer on June 9, 2026 at 3:42 am

    You may be confusing two different things here:

    1. Android does not kill an activity if it needs memory. What it does is that it kills the whole process that the activity is running in. In general that means that Android kills all of your activities in this situation. However, it remembers the activity stack and when the user returns to the application, Android will create a new process and then recreate each activity (in turn, as needed). It starts by recreating the activity that was on the top of the activity stack (ie: where the user left the application).

    2. Android assumes that if the user leaves a task for a long period of time (I think this is something like 30 minutes) then he is no longer interested in that task and there is no point in remembering where the user was in the activity stack of that task because he probably doesn’t care anymore. In this case, what happens is that when the user returns to the task (or restarts the application that was on the top of the activity stack in that task) Android simply clears the task back to the root activity. This has the effect that it looks like the application is starting all over again. This is the desired (and documented behaviour).

    What you want to do is prevent Android from clearing the task in situarion #2. You do it by adding

        android:alwaysRetainTaskState="true"
    

    to the <activity> tag of the root activity (ie: the activity that starts your application, the one with ACTION_MAIN and CATEGORY_LAUNCHER).

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

Sidebar

Related Questions

I am writing a android application using sqlite . There are many activities and
In my android application, I create shortcuts by code to some activities within my
Say I have two Activities in an Android application, EditPerson and EditEmployee . It
I have 2 activities: Activity1 and Activity2 . In each of this activities there
I need font typeface Helvetica in my application and works for all activities.there are
Suppose an application already has a stack of activities, and then a new activity
I have an app which has 4 activities in it.Within app, history activities, i.e.
Our team have built a web application using Ruby on Rails. It currently doesn't
I have an application with 3 tabs with one activity per tab. When I
In https://developers.google.com/+/api/latest/activities#object.attachments , there would have attachments in activities search response, but how to

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.