This is what is happening:
- Start the app.
- Exit the app by tapping on the Back key.
- Restart the app by tapping on its icon.
- Booooom - a Java language Runtime Exception occurs. The error lines are given below.
- Again restart the app by tapping on its icon.
- Now no problem...the app starts normally without any error.
The error lines shown are:
- A Java.Lang.RuntimeException was thrown.
- java.lang.reflection.InvocationTargetException
- (line) 33 MyProjectName.Android.MainActivity.OnCreate (Android.OS.Bundle) [0x00080]
My code of OnCreate() is (Line just before #endregion is the line 33):
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
#region Resolver Init
SimpleContainer container = new SimpleContainer();
container.Register<IDevice>(t => AndroidDevice.CurrentDevice);
container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
container.Register<INetwork>(t => t.Resolve<IDevice>().Network);
Resolver.SetResolver(container.GetResolver());
#endregion
global::Xamarin.Forms.Forms.Init (this, bundle);
LoadApplication (new App ());
}