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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:30:03+00:00 2026-06-08T18:30:03+00:00

I have the following two activities, ActivityA and ActivityB. In ActivityA.java startActivity(new Intent(this, ActivityB.class));

  • 0

I have the following two activities, ActivityA and ActivityB.

In ActivityA.java

startActivity(new Intent(this, ActivityB.class));
finish();

In ActivityB.java

public void onResume() {
    super.onResume();
    anim1 = new TranslateAnimation(0, 0, fromYDelta, -height);
    anim1.setDuration(8000);
    anim1.setFillAfter(true);
    anim1.setStartOffset(0);
    aView.startAnimation(anim1);
}

After the code in ActivityA that starts ActivityB and finishes itself has run, the activity life cycle callbacks were called in this order:

ActivityA.onPause();
ActivityB.onStart();
ActivityB.onResume(); //Start 8 seconds animation here
ActivityA.onStop();
ActivityA.onDestroy();

Now the issue is that ActivityA.onStop() was called 8 seconds after ActivityB.onResume() is called because of the 8-seconds animation started in ActivityB’s onResume(). It caused OutOfMemoryError in my app, because ActivityA.onDestroy() was called very late and the system had to hold all the resources in ActivityA for a long time.

Any suggestions? Thanks!

  • 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-08T18:30:05+00:00Added an answer on June 8, 2026 at 6:30 pm

    I was investigating this issue before and found out that Android OS does not guarantee that activity will be destroyed as soon as it goes to background. First of all, priority will be given to the new activity to get initialized and go to IDLE state. Only after that your previous activity will get destroyed.
    So there is no native solution for that. You should not expect onDestroy() to be called as soon as you call finish(). It is all up to OS when to call it

    Check these threads – probably it will shed some light on your problem:

    https://groups.google.com/forum/?fromgroups#!topic/android-developers/aDa7fiVL2Zg

    https://groups.google.com/forum/?fromgroups#!topic/android-developers/jkj_PvE9O1A

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

Sidebar

Related Questions

I have following two classes: template <size_t size> class Cont{ public: char charArray[size]; };
I have following two entities public class User { public int UserId { get;
I have two activities, NewTransferMyOwn.java and FromAccount.java When I go from NewTransferMyOwn.java to FromAccount.java,
I have a following JFrame. public class AddActivityWindow extends JFrame { //declaration of components
I have following two methods in my backing bean - public String validateUser() {
I have seen the following two examples of starting activities in Android: Example 1
I have two different activities in two packages as following: com.my.application.MyActivity1 com.my.application.Test.MyActivity2 In my
I have following two models class Questionnaire(models.model) name = models.CharField(max_length=128, null=True, blank=True) type =
I have following two arrays. I want the difference between these two arrays. That
How to wrap one div around another? I have following two div ids: #course

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.