您的位置:首页 > 移动开发

Intent实现跳转到网页,其他app的界面

2015-10-17 11:33 316 查看
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,否则无法正常跳转。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: