当前位置: 代码迷 >> Android >> android代码起步activity方法 包括子应用
  详细解决方案

android代码起步activity方法 包括子应用

热度:7   发布时间:2016-05-01 20:47:20.0
android代码启动activity方法 包括子应用

一、使用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);

  相关解决方案