Randy,

I just recently dealt with this issue, but I am not able to reproduce it.  I 
have the following example working:

    [Activity(Label = "TestApp", MainLauncher = true, Icon = "@drawable/icon")]
    public class Activity1 : Activity
    {

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate
            {
                this.StartActivity(typeof(Activity2));
            };
        }
    }

    [Activity(Label = "Activity2")]
    public class Activity2 : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main2);
        }
    }

Thank you,

Chris Tossing

P.S.  If you don't want the first activity to be in the "Back" history at all, 
you need to set NoHistory=true in the [Activity(...)] attribute.


From: [email protected] 
[mailto:[email protected]] On Behalf Of Randy Ficker
Sent: Wednesday, November 02, 2011 5:48 PM
To: [email protected]
Subject: [mono-android] Resuming app always reverts to first activity

I ran a simple test:


1.       Create a fresh Mono for Android project.  Add a second activity, and 
make the button of the default activity launch the second activity.

2.       Make an identical app in Eclipse using pure Java.

3.       Launch the Java app, tap the button to go to the second activity.  Now 
press Home, then re-launch the app.  Note that the app comes up on the second 
activity.

4.       Launch the Mono for Android app, tap the button to go to the second 
activity.  Now press Home, then re-launch the app.  The app comes up on the 
first activity.

This surprised me.  Why is there a difference?  And more importantly, how can 
Mono for Android apps resume where they left off like Java apps do?

Searching has turned up this question on 
StackOverflow<http://stackoverflow.com/questions/6114480/how-to-resume-android-app-where-it-was-suspended-app-not-activity>
 and I also found it asked a while ago on this alias, but neither has an answer 
to these questions.

Thanks!

The details of this company are as follows:
Touchcom Inc, Registered Office: 21 North Avenue, Burlington, MA 01803.

This communication may contain information which is confidential, personal 
and/or privileged.

It is for the exclusive use of the intended recipient(s).
If you are not the intended recipient(s), please note that any distribution, 
forwarding, copying or use of this communication or the information in it is 
strictly prohibited.

Any personal views expressed in this e-mail are those of the individual sender 
and the company does not endorse or accept responsibility for them.

Prior to taking any action based upon this e-mail message, you should seek 
appropriate confirmation of its authenticity.

This e-mail has been scanned for all viruses by MessageLabs.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to