一个app打开另一个app的指定页面方法 有以下几种

1、通过包名、类名

2、通过intent的 action

3、通过Url

方案1、

ComponentName componentName = new ComponentName("com.example.bi", "com.example.bi.SplashActivity");//这里是 包名  以及 页面类的全称
Intent intent = new Intent();
intent.setComponent(componentName);
intent.putExtra("type", "110");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
1.在Activity上下文之外启动Activity需要给Intent设置FLAG_ACTIVITY_NEW_TASK标志,不然会报异常。 
2.加了该标志,如果在同一个应用中进行Activity跳转,不会创建新的Task,只有在不同的应用中跳转才会创建新的Task

方案2、

在目标Activity的配置文件中添加具体的action

<!--ACTION启动配置-->
<intent-filter>
<action android:name="com.example.bi" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Intent intent = new Intent();
intent.setAction("com.example.bi");
intent.putExtra("type", "110");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

方案3、

<!--URL启动启动配置-->
<intent-filter>
<data
android:host="com.example.bi"
android:path="/cyn"
android:scheme="csd" />
<action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
Intent intent = new Intent();
intent.setData(Uri.parse("csd://com.example.bi/cyn?type=110"));
intent.putExtra("", "");//这里Intent当然也可传递参数,但是一般情况下都会放到上面的URL中进行传递
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

判断要打开的app是否安装:

public static boolean isApkInstalled(Context context, String packageName) {
if (TextUtils.isEmpty(packageName)) {
return false;
}
try {
ApplicationInfo info = context.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
return true;
} catch (NameNotFoundException e) {
e.printStackTrace();
return false;
}
}

android一个app打开另一个app的指定页面的更多相关文章

  1. Android 通过网页打开自己的APP(scheme)

    Android 通过网页打开自己的APP(scheme) 分类: android2014-07-09 17:35 8565人阅读 评论(2) 收藏 举报 通过用手机的浏览器(内置,第三方都可)访问一个 ...

  2. 在IE中点击转跳,并打开chorme浏览器继续浏览指定页面,IE自定义ocx控件开发

    因项目需要,需要开发一个功能:在IE中点击转跳,并打开chorme浏览器继续浏览指定页面. 分析需求后,参考了: https://www.cnblogs.com/ffjiang/p/7908025.h ...

  3. Android 通过网络打开自己的APP(scheme)

    通过使用手机的浏览器(内部.第三方能够)访问网页,点击一个链接,开始实施自己的应用程序,和传输数据. 第一Mainifest面对文件启动Activity添加过滤器. <activity andr ...

  4. 在android程序中打开另一个应用程序

    Android 开发有时需要在一个应用中启动另一个应用,比如Launcher加载所有的已安装的程序的列表,当点击图标时可以启动另一个应用. 一般我们知道了另一个应用的包名和MainActivity的名 ...

  5. 从一个Activity打开另外一个Activity

    public class MainActivity extends Activity { /** Called when the activity is first created. */ @Over ...

  6. APP打开(二)—标准流程

    APP打开是一个老生常谈的话题,在互联网时代,在APP遍地的时代,APP打开是每一个APP的必经之路,今天我想通过以下几点来阐述APP打开的标准流程,给这个话题写一点自己的见解. APP打开现状 标准 ...

  7. Android项目实战(二十二):启动另一个APP or 重启本APP

    一.启动另一个APP 目前公司项目需求,一个主APP,需要打开某些小APP,这些小APP是整合了Unity的,但是还是android程序(所有小APP的包名是已知的). 以前没做过,查询了一下实现方法 ...

  8. Android 一个app启动另一个app

    最近,一个app启动另一个app,这个玩法挺火的嘛,有没有试过更新QQ到5.1版本,QQ的健康里面就可以添加其他app,实现从QQ跳转到其他app应用.这个挺好玩的,一下子带来了多少流量啊. 一.先来 ...

  9. iOS 一个app跳转另一个app并实现通信(如A跳到B并打开B中指定页面)

    功能实现:A跳到B并打开B中指定页面 步骤: 1.首先创建两个项目(项目A,项目B),在项目B中的info.plist文件中添加URL Types,如下图所示:其中URL idenifier是项目B的 ...

随机推荐

  1. 反射 内省 BeanUtil 综合使用

    package com.zsphp.domain; public class User { private String userId; private String userName; privat ...

  2. Hashtable与ConcurrentHashMap区别(转)

    转载地址: https://blog.csdn.net/wisgood/article/details/19338693

  3. c#+cad2010+MQ接收消息

    cad2015+版本可以使用TrayItem气泡显示消息 static TrayItem trayItem = new TrayItem(); public static void testtrayi ...

  4. (转)SQLServer_十步优化SQL Server中的数据访问四

    原文地址:http://tech.it168.com/a2009/1125/814/000000814758_all.shtml 第八步:使用SQL事件探查器和性能监控工具有效地诊断性能问题 在SQL ...

  5. RAND函数和SRAND函数

    首先我们要对rand&srand有个总体的看法:srand初始化随机种子,rand产生随机数,下面将详细说明. rand(产生随机数) 表头文件: #include<stdlib.h&g ...

  6. hive 表新增字段后更新分区无法显示数据

    解决方案: 1.删除分区后重新跑数据 alter table drop partition(分区字段=“”): 2.新增字段运行程序后其实数据已经有了,只是查询hive的时候无法显示出来, 这个时候只 ...

  7. 实现A-Z滑动检索菜单

    我们实现一个A-Z滑动检索菜单,这是一个移动端非常常见的功能,页面效果图如下 在实现代码之前我们先了解下JS滚动事件和滑动事件 scrollTop 一个元素的scrollTop是这个元素的顶部 到 可 ...

  8. [Vue warn]: Duplicate keys detected: '1'. This may cause an update error

    今天遇到这个问题,遇到这个问题多数因为:key值的问题 第一种情况(key重复) <div class="name-list" v-for="(item,index ...

  9. jersey 开启gzip

    @Bean public ResourceConfig resourceConfig() { ResourceConfig resourceConfig = new ResourceConfig(); ...

  10. 菜鸟教程之学习Shell script笔记(下)

    菜鸟教程Shell script学习笔记(下) 以下内容是学习菜鸟教程之shell教程,所整理的笔记 菜鸟教程之shell教程:http://www.runoob.com/linux/linux-sh ...