Why does the 4.2 alpha version of Mono.Android.dll have a publickeytoken of 
c4c4237547e4b6cd whereas previous versions had one of null? As far as I know, 
binding redirection won't allow a work around on this, so previous 3rd party 
libraries can't be used because of this.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Thursday, May 10, 2012 6:15 PM
To: [email protected]
Subject: Monodroid Digest, Vol 22, Issue 44

Send Monodroid mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.ximian.com/mailman/listinfo/monodroid
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific than "Re: 
Contents of Monodroid digest..."


Today's Topics:

   1. Re: Odd behavior when restarting app (Randy Ficker)


----------------------------------------------------------------------

Message: 1
Date: Thu, 10 May 2012 15:14:43 -0700
From: "Randy Ficker" <[email protected]>
To: "'Discussions related to Mono for Android'"
        <[email protected]>
Subject: Re: [mono-android] Odd behavior when restarting app
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Actually the work-around I presented here does not seem to work after all.
It does fix the bug, but Android doesn't always reset statics when the app 
exits normally, so this can cause it to exit the app right after you launch it. 
 Instead, it's necessary to keep track of the number of instances that exist in 
memory:





    [Activity(MainLauncher = true)]

    public class Activity1 : Activity

    {

        private static int _numInstances = 0;



        protected override void OnCreate(Bundle bundle)

        {

            base.OnCreate(bundle);



            _numInstances++;



            if (_numInstances > 1)

                this.Finish();

            else

            {

                var btn = new Button(this);

                btn.Text = "One";

                btn.Click += (s, e) =>
this.StartActivity(typeof(Activity2));



                SetContentView(btn);

            }

        }



        protected override void OnDestroy()

        {

            base.OnDestroy();



            _numInstances--;

        }

    }





From: Randy Ficker [mailto:[email protected]]
Sent: Thursday, May 10, 2012 2:49 PM
To: 'Discussions related to Mono for Android'
Subject: RE: [mono-android] Odd behavior when restarting app



Hey Jon,



Thanks for the reply, but I think this issue is actually a new bug and not the 
same bug as what you linked.  In case you didn't realize, both of the links you 
gave me were written by me.



The differences are:



1.       That old bug did repro 100% of the time for me in 1.9.2, regardless
of the circumstances.  In this new bug, it works sometimes, but fails in 
specific circumstances.  I do believe that old bug was fixed in 4.0.1 as the 
bug describes, as everything worked great for me in 4.0.1.

2.       Under the old bug, the app was simply reverting to the first
activity.  That is, in the sample code below, Activity2 would simply be
getting deleted.    In this new bug, a new copy of the first activity is
created and pushed onto the stack.



The old bug was just a nuisance as it meant if the app was interrupted by a 
phone call or something the user just lost their state and had to start
over.   However, this new bug is far worse, since it leaves the app sort of
in a corrupt state with activities all out of order.



With the steps outlined, I can repro this 100% of the time.  If you try my 
steps and it doesn't repro for you, let me know and we can try to find the 
difference between our environments.



I wish I could go back to an earlier version of MfA, but 4.0.6 has the fix to 
allow ICS devices to use OpenTK apps, which is essential to me.  This 
restarting bug is the only thing preventing me from releasing my app to ICS 
users and they're growing restless J



The old bug was also impossible to work-around, since the activities were 
actually getting deleted.  This new bug can actually be fixed if you manually 
try to detect MfA creating a second instance of your main activity:



    [Activity(MainLauncher = true)]

    public class Activity1 : Activity

    {

        private static bool _exists = false;



        protected override void OnCreate(Bundle bundle)

        {

            Log.Info("", "Activity1.OnCreate");

            base.OnCreate(bundle);



            if (_exists)

                this.Finish();

            else

            {

                _exists = true;



                var btn = new Button(this);

                btn.Text = "One";

                btn.Click += (s, e) =>
this.StartActivity(typeof(Activity2));



                SetContentView(btn);

            }

        }

    }



This is obviously pretty hacky, but it works.  With this code, the new copy of 
Activity1 gets closed as soon as it's opened and the app works as expected.  
I'm still debating whether or not I should release my app this way.





-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jonathan Pryor
Sent: Thursday, May 10, 2012 1:08 PM
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Odd behavior when restarting app



On May 10, 2012, at 5:15 AM, Randy Ficker wrote:

> After re-launching the app, I would expect to see Activity2 presented
> to
the user.  Instead, it shows Activity1.  But the problem is much worse than 
just seeing the wrong activity, since if the user presses Back they actually go 
back to Activity2!  Going back again goes back to another copy of Activity1.



This is known, but I haven't been able to figure out why it happens yet:




<http://lists.ximian.com/pipermail/monodroid/2011-November/006985.html>
http://lists.ximian.com/pipermail/monodroid/2011-November/006985.html

                 <http://bugzilla.xamarin.com/show_bug.cgi?id=1919>
http://bugzilla.xamarin.com/show_bug.cgi?id=1919



Like you, I've had no luck getting a sample that repros 100% of the time, which 
makes it rather difficult to figure out what's going wrong...



Sorry,

- Jon



_______________________________________________

Monodroid mailing list

 <mailto:[email protected]> [email protected]



UNSUBSCRIBE INFORMATION:

 <http://lists.ximian.com/mailman/listinfo/monodroid>
http://lists.ximian.com/mailman/listinfo/monodroid

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.ximian.com/pipermail/monodroid/attachments/20120510/ad295bd7/attachment.html>

------------------------------

_______________________________________________
Monodroid mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monodroid


End of Monodroid Digest, Vol 22, Issue 44
*****************************************
STATEMENT OF CONFIDENTIALITY: The information in this message is privileged and 
confidential and is intended only for the use of the individual or entity named 
above. If the reader of this message is not the intended recipient, you are 
hereby notified that you are prohibited from disseminating, distributing, or 
copying the information contained in this message. If you have received this 
message in error, please notify the sender immediately and destroy all copies 
of the original message.
_______________________________________________
Monodroid mailing list
[email protected]

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

Reply via email to