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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:48:42+00:00 2026-05-23T12:48:42+00:00

I have an app that goes between many different activities. One activity, my main

  • 0

I have an app that goes between many different activities. One activity, my main activity, has it’s behavior dependent on which activity, within the app, launched the main activity. I thought i could log this by having every other activity put an extra called “launcehdFrom” into the intent, which contains a string that has the name of hte activity that called the main activity. The problem i ran into is that once that value has been set it can’t be overriden by another activity. I havne’t found a good straightforward method for doing this. Any advice??

The following code is called from onResume() in my main activity:

    private void processIntentRequest(){
    Intent intent = getIntent();
    ProcessIntentRequestType caller = (ProcessIntentRequestType)intent.getSerializableExtra("launchedFrom");
    switch(caller){
        case startUpActivity:
            load(this.myObj);
            break;

        case otherActivity:
            int uri = integer.parseInt(this.getIntent().getExtras().getString("uri"));          
            load(this.myObj, uri);
            break;

        default:
            load(this.myObj, 1);
    }

This is the code that launches the main activity the first time:

public void launchMainActivity(Obj myObj){
    Intent launchMain = new Intent(this, mainActivity.class);
    login.putExtra("launchedFrom", ProcessIntentRequestType.startupActivity);
    startActivity(launchMain);
}

This is the code that launches the main activity from some other activity after it has been loaded atleast once by the startup activity:

protected void launchMainActivity(Obj myObj, HelperObj helper) {
    String uri = helper.uri;
    Intent mainActivity = new Intent(this, MainActivity.class);
    mainActivity.putExtra("uri", uri);
    mainActivityputExtra("launchedFrom", ProcessIntentRequestType.otherActivity);
    startActivity(mainActivity.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
                    .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
    finish();
}
  • 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-23T12:48:43+00:00Added an answer on May 23, 2026 at 12:48 pm

    You are using FLAG_ACTIVITY_SINGLE_TOP when calling startActivity which has some notable behavior. In this case, override onNewIntent and call setIntent from there. After that, the platform will call onResume and your call to getIntent will return the new intent.

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

Sidebar

Related Questions

there is my situation. I have same activities which goes one by another, no
I have a control that goes inactive under some conditions in my iPhone app.
Have an app that has listings - think classified ads - and each listing
I have an app that needs to handle very large strings between a SQL
I have an app that goes in, replaces invalid chars (as defined by my
I have a Ruby on Rails app that has a scheduled job I execute
I have an app, that every 3 seconds, fires an event that goes to
The way I have my app set up now the initial activity that launches
I have a bit of a dilemma here. I have an app that has
I have an app that always terminate, never goes to suspend mode. I have

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.