[Monodroid] How to load Assets outside of an Activity?

Amir Waldman amirw2k at gmail.com
Tue Mar 1 10:11:50 EST 2011


That can't be good... What if you were in the middle of editing data? The
main activity (marked with: MainLauncher = true) holds the entire state of
the application. How can it kill and recreate itself?

Is there an easier way to instantly get a reference to Context? All I want
is to load an Asset using external code without worrying about it too much.



Regards,
Amir

-----Original Message-----
From: monodroid-bounces at lists.ximian.com
[mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Mike Kestner
Sent: Tuesday, March 01, 2011 5:01 PM
To: monodroid at lists.ximian.com
Subject: Re: [Monodroid] How to load Assets outside of an Activity?

On Tue, 2011-03-01 at 16:44 +0200, Amir Waldman wrote:
> Thanks for the detailed explanation Jon,
> 
> I ended up doing it the 'bad way' because I need to have my code
> disconnected from the 'Android Way' to make it compatible with 'Other
Ways'
> too :-)
> 
> To make things short, I had to pass a reference to the main activity as a
> global parameter only to load assets.

Not sure what you mean by global parameter here, but if you are keeping
hold of an Activity reference as a global variable, you may be in for
some surprises.  Activities appear to be a lot more dynamic than you
might think.  For instance, we've recently noticed that flipping the
screen orientation results in the creation of a new Activity, and the
destruction of the current one.

Mike

_______________________________________________
Monodroid mailing list
Monodroid at lists.ximian.com

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



More information about the Monodroid mailing list