android中使用代码启动其他程序
16lz
2021-01-25
一、使用Intent的setComponent方法
二、使用包管理器
一、使用Intent的setComponent方法
Intent intent = new Intent();
intent.setComponent(new ComponentName("包名", "包名.主类名"));
intent.setAction(Intent.ACTION_VIEW);
startActivity(intent);
二、使用包管理器
Intent intent = new Intent();
intent = getPackageManager().getLaunchIntentForPackage("包名");
startActivity(intent);
更多相关文章
- 在Android的webview中定制js的alert,confirm和prompt对话框的方
- Android应用程序避免Context相关的内存泄露的方法
- Android使用getIdentifier()获取资源Id的方法
- java基础学习总结之IO流和equal()方法
- Android(安卓)1.5 1.6 2.0 2.1 2.2 2.3 3.0的区别概要
- onSaveInstanceState和onRestoreInstanceState
- Android初级教程_获取Android控件的宽和高
- Android(安卓)在子线程中更新UI的几种方法示例
- 你了解Android中的Activity吗?