启动另一个Activity的方式

来源:互联网 发布:java项目简介怎么写 编辑:程序博客网 时间:2024/05/16 19:51
1.启动同一个App的Activity
Intent intent = new Intent();  intent.setClass(MainActivity.this, OtherActivity.class);  startActivity(intent);  

2.启动不同程序的Activity
(1)知道App启动Activity
Intent intent = new Intent();ComponentName componentName = new ComponentName("com.hello","com.hello.App1_A");intent.setComponent(componentName);startActivity(intent);

(2)只知道App的包名名
getContext().startActivity(packageManager.getLaunchIntentForPackage("com.roamingsoft.manager"));

转自:http://my.csdn.net/wike163/code/detail/21098
原创粉丝点击