Android 启动第三方程序的方法总结
Android启动第三方程序的方法总结
方法一:
Intentintent=newIntent(); intent.setClassName(, ); startActivity(intent);
方法二:
Intenti=newIntent; ComponentNamecom=newComponentName(, ); i.setComponent(com); startActivity(i);
启动媒体库
Intenti=newIntent(); ComponentNamecomp=newComponentName("com.Android.camera","com.android.camera.GalleryPicker"); i.setComponent(comp); i.setAction("android.intent.action.VIEW"); startActivity(i);
启动相机
IntentmIntent=newIntent(); ComponentNamecomp=newComponentName("com.android.camera","com.android.camera.Camera"); mIntent.setComponent(comp); mIntent.setAction("android.intent.action.VIEW"); startActivity(mIntent);
启动htmlviewer,并打开指定的一个文件注意TXT不能是ANSI的,否则会乱码
Intentintent=newIntent(); ComponentNamecn=newComponentName("com.android.htmlviewer","com.android.htmlviewer.HTMLViewerActivity"); intent.setComponent(cn); Uriuri=Uri.fromFile(newFile("/sdcard/demo.txt")); intent.setDataAndType(uri,"text/plain"); startActivity(intent);
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!