Search code examples
androidandroid-intentandroid-activityintentfilter

In Android Activity's intent action?


If an activity 'A' declares two actions in its manifest. and another activity named as 'B' starts the activity A by setting one of its action.

Is it possible for activity A to know which action is been set for calling ?

Activity B:

    Intent intent=new Intent(this,secondactovity.class);
    intent.setAction("lets.open.via.dashboard");
    startActivity(intent);

Activity A Manifest file:

  <activity android:name="com.example.testing.secondactovity">
       <intent-filter >
           <action android:name="lets.open.via.home"/>
           <action android:name="lets.open.via.you"/>
       </intent-filter>
   </activity>

Solution

  • Sure, in Activity A simply call:

    getIntent().getAction();