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>
我两种方法都试过,但都没有发现不同之处。什么更好?区别是什么?第二个用于启动其他应用程序。第二个用于启动其他应用程序。但我也可以启动其他应用程序,但我也可以启动其他应用程序,注意隐式和显式,注意隐式和显式