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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:02:56+00:00 2026-05-27T10:02:56+00:00

I have an Android application that contains two Activities . Activity A has a

  • 0

I have an Android application that contains two Activities.

Activity A has a button that launches Activity B using Context.startActivity(Intent intent).

There is also a Notification that opens Activity in the same way.

If I start B from this notification and press back button – it just closes B and does not shows A like I go there with normal case.

Is it possible to force B to bo back to A if started from notification without history stack ?

Solution

As stefan and Paul Lammertsma mentioned, the best way is to start A from notification and in A create new intent with B – but not in onCreate() !

I dig this a bit and found that if I set in AndroidManifest a new property for A activity:

android:launchMode="singleTask"

there will be in A activity called

onNewIntent(Intent intent)

And there we should checl if Intent containst extra value passed from notification – and if so, then we call new B intent.

Thank you both and good luck with it for next devs 😉

  • 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-27T10:02:57+00:00Added an answer on May 27, 2026 at 10:02 am

    I would suggest having the notification call Activity A (instead of B directly) with some flag in its extras bundle. In A’s onCreate(), check for the flag, and immediately launch Activity B. This will ensure that pressing back on B will return to A.

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

Sidebar

Related Questions

I have an application that contains 3 activities A, B and C. The activity
I have a service running in my Android application which contains a HashMap that
I have an android application which contains four modules(I mean four apk's).Each module has
I have two projects, my main android application and another test project that runs
I have an android application with a background thread that contains a socket connection
I'm developing an Android application that makes a Query using Activity.managedQuery() , which takes
I have an Android application that connects to Facebook to request authorization of an
I have a Web Service and an Android application that uses this web service.
I want to build an notepad-style application on android that will have syntax highlighting.
I have two threads in an Android application, one is the view thread, and

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.