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

IntentFilter施用

2012-08-22 
IntentFilter使用一直对于处于不同的application的activity的调用,心存疑虑。昨天,使用intent的隐式调用进

IntentFilter使用
一直对于处于不同的application的activity的调用,心存疑虑。
昨天,使用intent的隐式调用进行了实现。
首先,建立一个android 工程,就比如HelloWorld程序,只需要在该activity下加入属性:
<intent-filter>
<action android:name="com.able.test.aaa"></action>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
,再建立一个android工程,我们就称之为Test,只需要在里面使用:
Intent intentA = new Intent("com.able.test.aaa");
                intentA.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                startActivity(intentA);
就可以成功调用HelloWorld程序的那个加入了intent-filter的activity。

热点排行