首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2012-08-13 
android代码启动activity方法 包括子应用一、使用Intent的setComponent方法Intent intent new Intent()i

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);

热点排行