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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:45:10+00:00 2026-05-27T04:45:10+00:00

When I have two activities Activity A, B; // A stands for Login Screen

  • 0

When I have two activities

Activity A, B;
// A stands for Login Screen
// B stands for Main Application Screen

Application starts with A, then user performs login and he will be pointed to B

When I launch B I add this flag to Intent Intent.FLAG_ACTIVITY_CLEAR_TOP but when I finish the B I expect it to be the last activity and to quit the application.

Instead of what I expected, A is brought to front, and user stills on Login Screen again.

Should I start A from B as startActivityForResult and use B as main activity of whole application ?

Or the flag is not working as it should be?

  • 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-27T04:45:10+00:00Added an answer on May 27, 2026 at 4:45 am

    Don’t bother with intent flags. When activity A starts activity B after a successful login, just have A call finish().

    An alternative, slightly more involved, approach is to make B your main activity and in B’s onCreate method, start activity A for a result, which should be some pass/fail flag. When Activity A finishes (either on a successful login, failure, or the user just quitting), activity B determines in onActivityResult whether to continue or to finish, based on the returned value. This works because, according to the docs:

    As a special case, if you call startActivityForResult() with a requestCode >= 0 during the initial onCreate(Bundle savedInstanceState)/onResume() of your activity, then your window will not be displayed until a result is returned back from the started activity. This is to avoid visible flickering when redirecting to another activity.

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

Sidebar

Related Questions

I'm writing an application which will have two Activities, when the user presses the
suppose that you have two activities A(which is the main activity) and B when
I have two activities A and B. Activity A starts activity B. Now I'm
I have two activities, one is main and I have another activity called Test
In my application I have two activities. In the first activity I have a
I have two activities in my Android 2.1 application. The first is the Main
I have an Android application that contains two Activities . Activity A has a
I have two activities. One activity has the main game and the other activity
I have two activities, activity 1 and activity 2 for example. Activity 1 will
I have two activities. The first activity display list of the users with short

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.