读书人

android中施用代码启动其他程序

发布时间: 2012-09-27 11:11:17 作者: rapoo

android中使用代码启动其他程序
你要其他的程序,那程序要先到模器或真上面,因我要使用要其他程序的包。

的有以下方式(目前只知道):

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

热点推荐