在同一个应用中,大家都熟悉用Intent在Activity之间跳转。那么Intent能否再两个应用之间跳转呢。答案是肯定的。
在Android2.0 后的做如下:
app1 org.freedom.app1.HelloActivity
app2 org.freedom.app2.TestActivity
如何在app2的TestActivity调用app1的HelloActivity呢?
首先在app1的 AndroidManifest.xml中 HelloActivity声明中加入如下内容:
<intent-filter>
<action android:name=""/>
</intent-filter>
<action android:name=""/>
</intent-filter>
然后就可以调用了
TestActivity 中调用代码如下:
Intent Intent = new Intent();
intent.setClassName("org.freedom.app1", "org.freedom.app1.HelloActivity");
startActivity(intent);