On Jul 26, 2011, at 10:56 AM, Tim Kelly wrote:
> Ok, I'll look at that. I called it when the application starts and
> stuck it in a static class for now. Thanks, I'll look at passing it.
DO NOT stick an Activity into a static variable -- that way leads to memory
leaks.
If you need a static Context instance, stick an Android.App.Application into a
static varaible, e.g. via the Context.ApplicationContext instance property:
SomeStaticContext = this.ApplicationContext;
Alternatively you can use a custom Application and the [Application] custom
attribute to store a static Context:
[Application]
class MyApplication : Application {
public MyApplication(IntPtr handle)
: base (handle);
{
Context = this;
}
public static Context Context;
}
- Jon
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid