protected override void OnCreate(Bundle bundle) { RequestWindowFeature(WindowFeatures.NoTitle); _setup = MvxAndroidSetupSingleton.GetOrCreateSetup(ApplicationContext); if (!_primaryInitialized) { _primaryInitialized = true; // initialize app if necessary if (_setup.State == MvxBaseSetup.MvxSetupState.Uninitialized) { _setup.InitializePrimary(); } } base.OnCreate(bundle); if (_resourceId != NoContent) { // Set our view from the "splash" layout resource SetContentView(_resourceId); } }
public static MvxBaseAndroidSetup GetOrCreateSetup(Context applicationContext) { if (_instance != null) { return _instance; } lock (LockObject) { if (_instance != null) { return _instance; } var setupType = FindSetupType(); if (setupType == null) { throw new MvxException("Could not find a Setup class for application"); } try { _instance = (MvxBaseAndroidSetup)Activator.CreateInstance(setupType, applicationContext); } catch (Exception exception) { throw exception.MvxWrap("Failed to create instance of {0}", setupType.FullName); } return _instance; } }