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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:54:14+00:00 2026-05-25T18:54:14+00:00

Lets say we have activities A, B. A starts B and passes an Intent

  • 0

Lets say we have activities A, B. A starts B and passes an Intent Extra “id”. Now the weird-ness only seems to happen with certain actions.

Start App

A calls B passes Extra: id 1

While in B press the home button.

Find the app icon and click on it.

A calls B but this time I pass in Extra: id 2

Now in B when it prints out the id it is 1 even though I specified id 2.

From further analysis it doesn’t seem to be getting the new Intent, it seems to be using the old Intent, and the second time in doesn’t seem to be calling the onCreate it goes straight to onRestart. So my question is, is there a way to onRestart have it get the correct Intent Extras? It seems to be grabbing the old saved extras.

I am sorry if this is hard to follow, I will see if I can get a small sample app put together that demonstrates this.

EDIT It appears this scenerio is not normal, and it is caused because in my AndroidManifest.xml I had my activities with the property android:launchMode=”singleInstance” once I removed this it began acting as described by Rich.

  • 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-25T18:54:14+00:00Added an answer on May 25, 2026 at 6:54 pm

    When you press the Home button, B is still active. So, the next time you press your app’s icon, all it’s doing is resuming activity B. It’s not starting A and redirecting to B as it did the first time.

    Your best option is to maintain your state in a persistent storage (SharedPreferences, Sqlite, file, etc) so that you don’t rely on the Intent extras being passed around. You can already see that this is too clumsy of a method to rely on.

    The quick and dirty way to do it is to kill activity B when the user navigates away from it (thereby making sure that the next time your icon is pressed it loads Activity A first). Here’s the code for doing that, but I definitely recommend saving state properly as described above over a solution like this.

    @Override
    public void onPause()
    {
        super.onPause();
        finish();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 activities lets say A and B. In the first one(A) I
Lets say i have created a small game with XNA. Now i can change
Its possible to retain a Fragment between Activities? Lets say I have Activity A
Lets say I have three Activities in my App. 1) Signup Activity 2) AccountActivate
Lets say have this immutable record type: public class Record { public Record(int x,
Lets say I have a Dictionary object: Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();
Lets say I have the following code: abstract class Animal case class Dog(name:String) extends
Lets say I have several web sites on my web server, all as applications
Lets say I have an array like this: string [] Filelist = ... I
Lets say I have a single object of type Car which I want 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.