源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-09-26 19:17 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Android 启动第三方程序的方法总结
[b]Android 启动第三方程序的方法总结[/b] [b]方法一:[/b]
Intent intent = new Intent(); 
intent.setClassName(<package name>, <class name>); 
startActivity(intent);
[b]方法二:[/b]
Intent i=new Intent;
ComponentName com= new ComponentName(<Package Name> , <Calss Name>); 
i.setComponent(com); 
startActivity(i); 
[b]启动媒体库[/b]
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);

[b]启动相机[/b]
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);

[b]启动htmlviewer,并打开指定的一个文件 注意TXT不能是ANSI的,否则会乱码[/b]
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);

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部