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

  • Home
  • SEARCH
  • 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 9130447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:58:04+00:00 2026-06-17T07:58:04+00:00

Activity A is my mainscreen where the users can navigate to B,C,D. So in

  • 0

Activity A is my mainscreen where the users can navigate to B,C,D. So in normal circumstances, User would create Activity B from A and the stack would look like A->B. Pressing back from B takes you back to A.

I have another intent setup for activity B (for NFC), so that B could get directly launched under special circumstances. In this case, pressing back would just take me back to the home screen. I need the back button to take the user back to the main activity (A).

How can I accomplish this by directly manipulating the stack? If this isn’t possible, what is the best alternative?

  • 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-17T07:58:05+00:00Added an answer on June 17, 2026 at 7:58 am

    Use extras in your intent from activity A to pass the “name” of the caller, then just check these intents when leaving the activity and either make a new Intent for the main activity or just let it stop accordingly.

    In Activity A, when calling B:

    Intent intent = new Intent(this, ActivityB.class);
    intent.putExtra("caller", "ActivityA");
    startActivity(intent);
    

    In Activity B:

    String caller = getIntent().getStringExtra("caller");
    

    When stopping activity B, if the caller isn’t ActivityA then start it.

    if(!caller.equals("ActivityA")) {
       Intent intent = new Intent(this, ActivityA.class);
       startActivity(intent);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make sure that when user log in it will stay
I would like to show a splash screen view with activity indicator to load
i have made an app that would calculate numbers from input fields. **main Activity
So when a user clicks on a button in my app, I would like
My Activity creates an AsyncTask that loads data from a file and updates the
In activity I load preferences like: public void LoadFontSize(){ sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); loadedFontSize =
There is an Activity and some variable's. They are passed from previous one. The
I am facing issue with showing AlertDialog when I switch from one activity to
I am developing an application which starts from LoginPage. When user Login then he
Example 1 - works public class MainScreen extends Activity implements OnClickListener { public void

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.