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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:56:04+00:00 2026-05-28T18:56:04+00:00

I realize there are several topics about this issue, but none provides a working

  • 0

I realize there are several topics about this issue, but none provides a working solution for me, so I’m posting this problem again and hopefully can get some solutions/suggestions.

So what’s happening is, I have an application that contain 2 activities. The first one is for Login, for now I haven’t implemented the login feature and all it does is click a button and the second activity gets launched. The second activity then displays a map, centered by user current location. It also contains a logout button to go back to the 1st login activity.

Now the login activity is the LAUNCHER activity because I apparently want user to login when they first open this app. Then after login button clicked I start the 2nd map activity and finishes the 1st.

However, if I leave the 2nd map activity by hitting home button, The map activity is put to run in the background. Now, if I open this app from the ‘recent’ opened app list, it will go back to the 2nd map app, which is desired. But if I open from the app list on android desktop. then it will launch a new instance of 1st login activity, instead of resume to where I left (the 2nd map activity). And the map activity is just behind it in the stack (I think) because in the newly launched login activity, if I hit back, it actually return to the map activity as where I left it.

in short, I wish to launch the app from the saved instance of this app, if there is one. I have seem this and it’s not quite my problem.

I hope this is a clear description of my problem. Here are the relevant codes. I’m using Mono for Android to code, but I don’t think it matters.

Login : Activity

        loginButton.Click += delegate 
        {
            StartActivityForResult(typeof(MapDemo), 0);
            Finish();
        };

MapDemo : MapActivity

        logoutButton.Click += delegate
        {
            var intent = new Intent();
            SetResult(Result.Ok, intent);
            Finish();

        };

Here are some links I found that has similar problem as I do.

Start activity after Resume
http://forum.xda-developers.com/showthread.php?t=856386
Android Resume Activity

I realize it might be because of I’m using the StartActivityForResult method incorrectly. It is a bit different using mono, but if you have a guess about what my problem might be, please point it out for me. Thank you a lot!

  • 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-28T18:56:06+00:00Added an answer on May 28, 2026 at 6:56 pm

    You might consider something like a start-up activity that is either the splash screen or has no layout resource at all.

    I bootstrap applications this way. In the code, you could detect whether the user is logged in and conditionally show the login screen.

    If you don’t want the user to be able to go back to the splash/start activity by using the back button, you can use something like this (which I believe I got from another StackOverflow answer):

        public override void OnAttachedToWindow()
        {
            var finishTime = DateTime.Now.AddMilliseconds(3000);
    
            base.OnAttachedToWindow();
            new Thread(() =>
            {
                while (DateTime.Now < finishTime) Thread.Sleep(100);
                RunOnUiThread(Finish);
            }).Start();
        }
    

    This will take that activity off the stack after three seconds.

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

Sidebar

Related Questions

I realize there are several solutions to this problem. I am looking for advice
I realize there's already been several questions like this, but I think my case
I realize there's no definitely right answer to this question, but when people talk
I realize there are similar questions on this topic, but I still cannot find
I realize there are 10,000 answers for this on StackOverflow, but my needs are
I'm really sorry, I realize there have been several questions asked about cocos2d touch
I know that there have been plenty of topics describing this topic but I
I realize there are several SO questions on the subject and this one describes
I realize there is a somewhat related thread on this here: Loading assemblies and
I realize there's a way in Vim to hide/fold lines, but what I'm looking

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.