2017-02-04 82 views
1

我总是先从意图活动的活动,但在书里面我读活动启动与动作参数: 在这经典的方法安卓:开始的意图或意向过滤器

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> 

我尝试了两种方式,但没有找到区别。什么是更好的?有什么不同?

+0

阅读https://developer.android.com/guide/components/intents-filters.html#Types,通知**隐式**和**显式** – pskink

回答

0

第二个用于启动另一个应用程序。

+0

但我也可以启动其他应用程序的意图 – Curio