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

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

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

Instrumentation.finish介绍

暂无

代码示例

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

@Override
public void finish(int resultCode, Bundle results) {
  base.finish(resultCode, results);
}

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

@Override
public void finish(int resultCode, Bundle results) {
  base.finish(resultCode, results);
}

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

@Override
public void finish(int resultCode, Bundle results) {
  base.finish(resultCode, results);
}

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

@Override
@CallSuper
public void finish(int resultCode, Bundle results) {
  if (DEBUG) {
    Logger.d(TAG,"finish");
  }
  mInstrumentation.finish(resultCode, results);
}

代码示例来源:origin: Eaway/AppCrawler

public static boolean launchApp(String targetPackage) {
  FileLog.i(TAG_MAIN, "{Launch} " + targetPackage);
  UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
  String launcherPackage = device.getLauncherPackageName();
  if (launcherPackage.compareToIgnoreCase(targetPackage) == 0) {
    launchHome();
    return true;
  }
  Context context = InstrumentationRegistry.getContext();
  final Intent intent = context.getPackageManager().getLaunchIntentForPackage(targetPackage);
  if (intent != null) {
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Make sure each launch is a new task
    context.startActivity(intent);
    device.wait(Until.hasObject(By.pkg(Config.sTargetPackage).depth(0)), Config.sLaunchTimeout);
  } else {
    String err = String.format("(%s) No launchable Activity.\n", targetPackage);
    Log.e(TAG, err);
    Bundle bundle = new Bundle();
    bundle.putString("ERROR", err);
    InstrumentationRegistry.getInstrumentation().finish(1, bundle);
  }
  return true;
}

相关文章

Instrumentation类方法