android.app.Instrumentation.callActivityOnStart()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中android.app.Instrumentation.callActivityOnStart()方法的一些代码示例,展示了Instrumentation.callActivityOnStart()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instrumentation.callActivityOnStart()方法的具体详情如下:
包路径:android.app.Instrumentation
类名称:Instrumentation
方法名:callActivityOnStart

Instrumentation.callActivityOnStart介绍

暂无

代码示例

代码示例来源:origin: android-hacker/VirtualXposed

@Override
public void callActivityOnStart(Activity activity) {
  base.callActivityOnStart(activity);
}

代码示例来源:origin: limpoxe/Android-Plugin-Framework

@Override
public void callActivityOnStart(Activity activity) {
  PluginInjector.injectInstrumetionFor360Safe(activity, this);
  real.callActivityOnStart(activity);
}

代码示例来源:origin: bzsome/VirtualApp-x326

@Override
public void callActivityOnStart(Activity activity) {
  base.callActivityOnStart(activity);
}

代码示例来源:origin: darkskygit/VirtualApp

@Override
public void callActivityOnStart(Activity activity) {
  base.callActivityOnStart(activity);
}

代码示例来源:origin: gdpancheng/LoonAndroid3

@Override
public void callActivityOnStart(Activity activity) {
  AnalysisManager.analysisProcess(activity, LoonConstant.Number.ACTIVITY_START);
  super.callActivityOnStart(activity);
}

代码示例来源:origin: luili16/UIMocker

@Override
@CallSuper
public void callActivityOnStart(Activity activity) {
  if (DEBUG) {
    Logger.d(TAG,"callActivityOnStart");
  }
  mInstrumentation.callActivityOnStart(activity);
}

代码示例来源:origin: stackoverflow.com

@UiThreadTest
public void testResumeAfterStop() {
  Instrumentation instr = this.getInstrumentation();

  // here, test or record down whatever should be tested 
  // when the activity is in resume state the first time

  instr.callActivityOnPause(getActivity());
  instr.callActivityOnStop(getActivity());
  instr.callActivityOnRestart(getActivity());
  instr.callActivityOnStart(getActivity());
  instr.callActivityOnResume(getActivity());

  // Now you are in the resume state again. 
  // Test whatever you need here.

}

代码示例来源:origin: mttkay/calculon

/**
 * Launches the activity under test using the given extras. This method will call all life-cycle
 * methods involved in an activity launch.
 * 
 * @param extras
 *            any custom extras to add to the intent used to start the activity
 * @return the intent used to start the activity
 */
public Intent launchActivity(Bundle extras) {
  Intent intent = prepareIntent(extras);
  startActivity(extras); // this calls onCreate
  getInstrumentation().callActivityOnStart(getActivity());
  getInstrumentation().callActivityOnResume(getActivity());
  getInstrumentation().waitForIdleSync();
  return intent;
}

代码示例来源:origin: THEONE10211024/ApiDemos

/**
 * This test demonstrates ways to exercise the Activity's life cycle.
 */
@MediumTest
public void testLifeCycleCreate() {
  Forwarding activity = startActivity(mStartIntent, null, null);
  
  // At this point, onCreate() has been called, but nothing else
  // Complete the startup of the activity
  getInstrumentation().callActivityOnStart(activity);
  getInstrumentation().callActivityOnResume(activity);
  
  // At this point you could test for various configuration aspects, or you could 
  // use a Mock Context to confirm that your activity has made certain calls to the system
  // and set itself up properly.
  
  getInstrumentation().callActivityOnPause(activity);
  
  // At this point you could confirm that the activity has paused properly, as if it is
  // no longer the topmost activity on screen.
  
  getInstrumentation().callActivityOnStop(activity);
  
  // At this point, you could confirm that the activity has shut itself down appropriately,
  // or you could use a Mock Context to confirm that your activity has released any system
  // resources it should no longer be holding.
  // ActivityUnitTestCase.tearDown(), which is always automatically called, will take care
  // of calling onDestroy().
}

代码示例来源:origin: qiubiteme/android_api_demos

/**
 * This test demonstrates ways to exercise the Activity's life cycle.
 */
@MediumTest
public void testLifeCycleCreate() {
  Forwarding activity = startActivity(mStartIntent, null, null);
  
  // At this point, onCreate() has been called, but nothing else
  // Complete the startup of the activity
  getInstrumentation().callActivityOnStart(activity);
  getInstrumentation().callActivityOnResume(activity);
  
  // At this point you could test for various configuration aspects, or you could 
  // use a Mock Context to confirm that your activity has made certain calls to the system
  // and set itself up properly.
  
  getInstrumentation().callActivityOnPause(activity);
  
  // At this point you could confirm that the activity has paused properly, as if it is
  // no longer the topmost activity on screen.
  
  getInstrumentation().callActivityOnStop(activity);
  
  // At this point, you could confirm that the activity has shut itself down appropriately,
  // or you could use a Mock Context to confirm that your activity has released any system
  // resources it should no longer be holding.
  // ActivityUnitTestCase.tearDown(), which is always automatically called, will take care
  // of calling onDestroy().
}

相关文章

Instrumentation类方法