[mono-android] Custom Application Object
BernhardGessler at cs-ag.de
BernhardGessler at cs-ag.de
Mon Mar 21 10:13:46 EDT 2011
Hi,
i am, trying to have my own application object:
using Android.App;
namespace CSMobile.UI
{
[Application()]
class MyApp : Application
{
private string _test;
public string Test
{
get { return _test; }
set { _test = value; }
}
public override void OnCreate()
{
base.OnCreate();
Program_Logic logic = new Program_Logic();
logic.LoadConfig(this);
}
}
}
But when i start the Application the following error throws:
03-21 15:03:43.280 5877 5877 I MonoDroid: UNHANDLED EXCEPTION:
System.NotSupportedException: Unable to activate instance of type
CSMobile.UI.MyApp from native handle 459ebe48 --->
System.MissingMethodException: No constructor found for
CSMobile.UI.MyApp::.ctor(System.IntPtr)
03-21 15:03:43.280 5877 5877 I MonoDroid: at
Android.Runtime.TypeManager.CreateProxy (System.Type type, IntPtr handle)
[0x00000] in <filename unknown>:0
03-21 15:03:43.280 5877 5877 I MonoDroid: at
Android.Runtime.TypeManager.CreateInstance (IntPtr handle, System.Type
targetType) [0x00000] in <filename unknown>:0
03-21 15:03:43.280 5877 5877 I MonoDroid: --- End of inner exception
stack trace ---
03-21 15:03:43.280 5877 5877 I MonoDroid: at
Android.Runtime.TypeManager.CreateInstance (intptr,System.Type) <0x0057c>
03-21 15:03:43.280 5877 5877 I MonoDroid: at Java.Lang.Object.GetObject
(intptr,System.Type,bool) <0x00223>
03-21 15:03:43.280 5877 5877 I MonoDroid: at
Java.Lang.Object._GetObject<Android.App.Application> (intptr,bool)
<0x0004f>
03-21 15:03:43.280 5877 5877 I MonoDroid: at
Java.Lang.Object.GetObject<Android.App.Application> (intptr,bool)
<0x0002b>
03-21 15:03:43.280 5877 5877 I MonoDroid: at
Android.App.Application.n_OnCreate (intptr,intptr) <0x00023>
03-21 15:03:43.280 5877 5877 I MonoDroid: at (wrapper dynamic-method)
object.e64d49ee-e048-4001-b616-2396f819a424 (intptr,intptr) <0x0002b>
If I remove the OnCreate Method my app starts without crashing. But it
crashes with the same exception as soon as i call
this.ApplicationContext
in one of my activities.
Thaks for your help in advance
Bernhard Geßler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110321/cdec5af2/attachment.html
More information about the Monodroid
mailing list