android中通过代码启动应用程序


效果如上,也就是实现应用程序的管理功能:

运行:1.取得应用程序具有启动属性的Activity,也就是主Activity。

Log.i(TAG, infos.get(position)+"运行");try {PackageInfo info = getPackageManager().getPackageInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES|PackageManager.GET_ACTIVITIES);ActivityInfo [] activityInfos = info.activities;ActivityInfo activityInfo = activityInfos[0];Intent intent = new Intent();intent.setClassName(packageName, activityInfo.name);startActivity(intent);} catch (Exception e) {Toast.makeText(this, "应用程序无法启动", 0).show();e.printStackTrace();}



更多相关文章

  1. android:nextFocus 属性介绍
  2. android 硬件加速
  3. android4.0下使用multiDexEnabled属性的踩坑日记
  4. Studio报错 You need to use a Theme.AppCompat theme的两种解决
  5. Fragment 和 Activity 全通讯
  6. android学习记录(三) UI界面
  7. Android完全关闭应用程序
  8. Android(安卓)studio中 RelativeLayout 的 layout_marginBottom
  9. Android(安卓)自定义View步骤

随机推荐

  1. Android(安卓)资源文件中@、@android:typ
  2. android中系统自带主题集锦
  3. Android字母索引、Android通讯录索引、An
  4. Android(安卓)保活
  5. Android乱码
  6. Android(安卓)开发实践(一)开始你的 Hello
  7. Android常用布局
  8. Android中的android:layout_width和andro
  9. Android(安卓)SDK 下载地址
  10. 安卓-android:layout_width和android:wid