On Sep 15, 2011, at 8:28 AM, moelski wrote:
> > Alternatively, you could stuff it in the Application object
> Where can I find this object (which file is it)?

>From the Context.ApplicationContext documentation [0]:

        Return the context of the single, global Application object of the 
current process.

Thus, you retrieve an Anadroid.App.Application instance by using the 
Context.ApplicationContext property.

Can you provide your own Application subclass? Yes [1]:

        You can provide your own implementation by specifying its name in your 
AndroidManifest.xml's <application> tag, which will cause that class to be 
instantiated for you when the process for your application/package is created.

Unfortunately that's the Android documentation. From C#, you just need to use 
the [Application] custom attribute, and provide an (IntPtr) constructor:

        [Application]
        public class MyApp : Android.App.Application {
                public MyApp(IntPtr handle)
                        : base (handle)
                {
                }
        }

A single instance of `MyApp` will be created during app startup, and will live 
for the lifetime of the process.

 - Jon

[0] 
http://docs.mono-android.net/index.aspx?link=P%3aAndroid.Content.Context.ApplicationContext
[1] http://docs.mono-android.net/index.aspx?link=T%3aAndroid.App.Application
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

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

Reply via email to