android启动多个第三方app吗,Android 启动第三方程序的方法总结

本文详细介绍了在Android中启动第三方应用的多种方法,包括通过Intent设置ClassName和ComponentName,以及启动媒体库、相机和HTML查看器的示例代码。这些方法对于Android开发者在集成不同功能时非常实用。
摘要由CSDN通过智能技术生成

Android 启动第三方程序的方法总结

方法一:

Intent intent = new Intent();

intent.setClassName(, );

startActivity(intent);

方法二:

Intent i=new Intent;

ComponentName com= new ComponentName( , );

i.setComponent(com);

startActivity(i);

启动媒体库

Intent i = new Intent();

ComponentName comp = new ComponentName("com.Android.camera","com.android.camera.GalleryPicker");

i.setComponent(comp);

i.setAction("android.intent.action.VIEW");

startActivity(i);

启动相机

Intent mIntent = new Intent();

ComponentName comp = new ComponentName("com.android.camera","com.android.camera.Camera");

mIntent.setComponent(comp);

mIntent.setAction("android.intent.action.VIEW");

startActivity(mIntent);

启动htmlviewer,并打开指定的一个文件 注意TXT不能是ANSI的,否则会乱码

Intent intent = new Intent();

ComponentName cn = new ComponentName("com.android.htmlviewer", "com.android.htmlviewer.HTMLViewerActivity");

intent.setComponent(cn);

Uri uri = Uri.fromFile(new File("/sdcard/demo.txt"));

intent.setDataAndType(uri, "text/plain");

startActivity(intent);

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值