private void jumpToUrl() {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Uri content_url = Uri.parse("https://www.baidu.com/");
intent.setData(content_url);
startActivity(intent);
}
private void jumpToMicroTest() {
ComponentName componentName=new ComponentName("com.lany.screenshot","com.lany.screenshot.MainActivity");
Intent intent = new Intent();
intent.setComponent(componentName);
intent.setAction(Intent.ACTION_VIEW);
intent.putExtra("Version", getSimpleVersionInfo());
intent.putExtra("buildNumber", buildNumber);
startActivity(intent);
}
除了跳转,还可以附带数据,注意在跳转到其他app时,跳转到的app必须在跳转到的界面的manifest文件中定义exported=true,否则无法正常跳转。