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)