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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:55:46+00:00 2026-05-27T08:55:46+00:00

when my android app – Activity B – is moved to the background (by

  • 0

when my android app – Activity B – is moved to the background (by the user pressing the android home button), it is still alive, onStop() was called as expected.

Activity B has not been destroyed here, but when the user clicks on the app’s icon again, it calls the intent-filter MAIN and LAUNCHER again, starting Activity A, instead of calling onResume() on Activity B.

so the launch activity is shown – Activity A – , but if the user presses android back button, then launch activity finishes() , and the old activity – Activity B – is shown!

what should happen when Activity B is moved to the background is that Activity B is paused and stopped. When the app is resumed by pressing the app icon, Activity B should be resumed. (unless it was killed and destroyed, which it hasn’t been)

How do I fix this? Activity B is originally opened by Activity A using

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

Here is the manifest entry for Activity B

<activity android:name=".ActivityB"
    android:screenOrientation="portrait"
              android:label="@string/app_name"
              android:configChanges="orientation|keyboardHidden">
</activity>

Here is the manifest entry for Activity A

<activity android:name=".Activity A"
     android:screenOrientation="portrait"
              android:label="@string/app_name"
              android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>

why is this happening and how do I fix it?

  • 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-05-27T08:55:47+00:00Added an answer on May 27, 2026 at 8:55 am

    Use android:launchMode="singleTask" in your manifeast file where you declare activity b. Then activity b not display in background.

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

Sidebar

Related Questions

import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button;
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.RelativeLayout; public class
I've got an Android app which has a periodic background Service. I want this
My android-app gets List in the one activity, but activity,that contains the LisView for
Every activity within my android app is generated using HTML. When one of the
My Android app is getting called by an intent that is passing information (pendingintent
My Android app opens images and makes manipulations on them. My Activity requests an
My Android app is trying to urge a user to upgrade a particular app
I have an Android app that looks absolutely horrible if the user sets their
My Android app is created with a tab bar and the root activity is

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.