Android使用Intent启动其他非系统应用程序的方法
本文实例讲述了Android使用Intent启动其他非系统应用程序的方法。分享给大家供大家参考,具体如下:
android应用程序内部通过Intent来实现Activity间的跳转。也知道通过Intent调用系统程序。但若想在应用程序A内开启应用程序B(前提是A、B均已安装),该如何去实现?
记录下实现过程。
在应用程序A内添加如下代码:
Intenti=newIntent();
i.setClassName("com.example.a","com.example.a.AActivity");
startActivity(i);
或者
Intenti=newIntent();
ComponentNamecn=newComponentName("com.example.b","com.example.b.BActivity");
i.setComponent(cn);
startActivity(i);
注:
com.example.a是应用程序B的包名
com.example.a.AActivity是应用程序B你将要启动的Activtiy
这样就可以OK了。
希望本文所述对大家Android程序设计有所帮助。
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下