public android.app.Application makeApplication(bool forceDefaultAppClass, android.app.Instrumentation instrumentation) { if (mApplication != null) { return(mApplication); } android.app.Application app = null; string appClass = mApplicationInfo.className; if (forceDefaultAppClass || (appClass == null)) { appClass = "android.app.Application"; } try { java.lang.ClassLoader cl = getClassLoader(); android.app.ContextImpl appContext = new android.app.ContextImpl(); appContext.init(this, null, mActivityThread); app = mActivityThread.mInstrumentation.newApplication(cl, appClass, appContext); appContext.setOuterContext(app); } catch (System.Exception e) { if (!mActivityThread.mInstrumentation.onException(app, e)) { throw new java.lang.RuntimeException("Unable to instantiate application " + appClass + ": " + e.ToString(), e); } } mActivityThread.mAllApplications.add(app); mApplication = app; if (instrumentation != null) { try { instrumentation.callApplicationOnCreate(app); } catch (System.Exception e) { if (!instrumentation.onException(app, e)) { throw new java.lang.RuntimeException("Unable to create application " + app.GetType ().FullName + ": " + e.ToString(), e); } } } return(app); }
public android.app.Application makeApplication(bool forceDefaultAppClass, android.app.Instrumentation instrumentation) { if (mApplication != null) { return mApplication; } android.app.Application app = null; string appClass = mApplicationInfo.className; if (forceDefaultAppClass || (appClass == null)) { appClass = "android.app.Application"; } try { java.lang.ClassLoader cl = getClassLoader(); android.app.ContextImpl appContext = new android.app.ContextImpl(); appContext.init(this, null, mActivityThread); app = mActivityThread.mInstrumentation.newApplication(cl, appClass, appContext); appContext.setOuterContext(app); } catch (System.Exception e) { if (!mActivityThread.mInstrumentation.onException(app, e)) { throw new java.lang.RuntimeException("Unable to instantiate application " + appClass + ": " + e.ToString(), e); } } mActivityThread.mAllApplications.add(app); mApplication = app; if (instrumentation != null) { try { instrumentation.callApplicationOnCreate(app); } catch (System.Exception e) { if (!instrumentation.onException(app, e)) { throw new java.lang.RuntimeException("Unable to create application " + app.GetType ().FullName + ": " + e.ToString(), e); } } } return app; }
/// <summary> /// Perform instantiation of an /// <see cref="Activity">Activity</see> /// object. This method is intended for use with /// unit tests, such as android.test.ActivityUnitTestCase. The activity will be useable /// locally but will be missing some of the linkages necessary for use within the sytem. /// </summary> /// <param name="clazz">The Class of the desired Activity</param> /// <param name="context">The base context for the activity to use</param> /// <param name="token">The token for this activity to communicate with</param> /// <param name="application">The application object (if any)</param> /// <param name="intent">The intent that started this Activity</param> /// <param name="info">ActivityInfo from the manifest</param> /// <param name="title">The title, typically retrieved from the ActivityInfo record</param> /// <param name="parent">The parent Activity (if any)</param> /// <param name="id">The embedded Id (if any)</param> /// <param name="lastNonConfigurationInstance"> /// Arbitrary object that will be /// available via /// <see cref="Activity.getLastNonConfigurationInstance()">Activity.getLastNonConfigurationInstance() /// </see> /// . /// </param> /// <returns>Returns the instantiated activity</returns> /// <exception cref="java.lang.InstantiationException">java.lang.InstantiationException /// </exception> /// <exception cref="System.MemberAccessException">System.MemberAccessException</exception> public virtual android.app.Activity newActivity <_T0>(android.content.Context context , android.os.IBinder token, android.app.Application application, android.content.Intent intent, android.content.pm.ActivityInfo info, java.lang.CharSequence title, android.app.Activity parent, string id, object lastNonConfigurationInstance) { System.Type clazz = typeof(_T0); android.app.Activity activity = (android.app.Activity)System.Activator.CreateInstance (clazz); android.app.ActivityThread aThread = null; activity.attach(context, aThread, this, token, application, intent, info, title, parent, id, (android.app.Activity.NonConfigurationInstances)lastNonConfigurationInstance , new android.content.res.Configuration()); return(activity); }
/// <summary> /// Perform calling of the application's /// <see cref="Application.onCreate()">Application.onCreate()</see> /// method. The default implementation simply calls through to that method. /// </summary> /// <param name="app">The application being created.</param> public virtual void callApplicationOnCreate(android.app.Application app) { app.onCreate(); }
internal void attach(android.content.Context context, android.app.ActivityThread aThread, android.app.Instrumentation instr, android.os.IBinder token, int ident, android.app.Application application, android.content.Intent intent, android.content.pm.ActivityInfo info, java.lang.CharSequence title, android.app.Activity parent, string id, android.app.Activity .NonConfigurationInstances lastNonConfigurationInstances, android.content.res.Configuration config) { attachBaseContext(context); mFragments.attachActivity(this); mWindow = [email protected](this); mWindow.setCallback(this); mWindow.getLayoutInflater().setPrivateFactory(this); if (info.softInputMode != android.view.WindowManagerClass.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { mWindow.setSoftInputMode(info.softInputMode); } if (info.uiOptions != 0) { mWindow.setUiOptions(info.uiOptions); } mUiThread = java.lang.Thread.currentThread(); mMainThread = aThread; mInstrumentation = instr; mToken = token; mIdent = ident; mApplication = application; mIntent = intent; mComponent = intent.getComponent(); mActivityInfo = info; mTitle = title; mParent = parent; mEmbeddedID = id; mLastNonConfigurationInstances = lastNonConfigurationInstances; mWindow.setWindowManager(null, mToken, mComponent.flattenToString(), (info.flags & android.content.pm.ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0); if (mParent != null) { mWindow.setContainer(mParent.getWindow()); } mWindowManager = mWindow.getWindowManager(); mCurrentConfig = config; }
public void attach(android.content.Context context, android.app.ActivityThread thread , string className, android.os.IBinder token, android.app.Application application , object activityManager) { throw new System.NotImplementedException(); }