Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android:使用意图或意图过滤器启动活动_Java_Android_Android Intent_Intentfilter - Fatal编程技术网

Java Android:使用意图或意图过滤器启动活动

Java Android:使用意图或意图过滤器启动活动,java,android,android-intent,intentfilter,Java,Android,Android Intent,Intentfilter,我总是以意图开始活动,但在我正在阅读的书中,活动是以动作参数开始的: 不是以这种传统的方式 Intent intent = new Intent(this,ActivityResult.class); 但这样做: String PICK_BUS_ACTION = "com.example.utente.decompilare" + ".action.PICK_BUS_ACTION"; Intent intent = new Intent(PICK_BUS_ACTION); 在清单中有一个意图

我总是以意图开始活动,但在我正在阅读的书中,活动是以动作参数开始的: 不是以这种传统的方式

Intent intent = new Intent(this,ActivityResult.class);
但这样做:

String PICK_BUS_ACTION = "com.example.utente.decompilare" + ".action.PICK_BUS_ACTION";
Intent intent = new Intent(PICK_BUS_ACTION);
在清单中有一个意图过滤器:

<activity android:name=".ActivityResult">
        <intent-filter>
            <action android:name="com.example.utente.decompilare.action.PICK_BUS_ACTION" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>


我两种方法都试过,但都没有发现不同之处。什么更好?区别是什么?

第二个用于启动其他应用程序。

第二个用于启动其他应用程序。

但我也可以启动其他应用程序,但我也可以启动其他应用程序,注意隐式和显式,注意隐式和显式