Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can not understand intent filter

I was reading intent & intent filter. i got the below code:

In activity:

 Intent i = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));  
 startActivity(i);

In Manifest:

<activity android:name="com.example.intentdemo.CustomActivity" 
        android:label="@string/app_name">            
  <intent-filter>               
   <action android:name="android.intent.action.VIEW" /> 
   <action android:name="com.example.intentdemo.LAUNCH" /> 
   <category android:name="android.intent.category.DEFAULT" />
   <data android:scheme="http" />            
  </intent-filter>         
</activity>

My question is that- am i not supposed to declare android.Intent.ACTION_VIEW , instead of android.content.Intent.ACTION_VIEW inside the intent?

like image 424
shaon007 Avatar asked Nov 11 '22 13:11

shaon007


1 Answers

android.content.Intent.ACTION_VIEW refers to the name of the constant ACTION_VIEW in the class android.content.Intent. The value of this constant is "android.intent.action.VIEW". Hence the difference.

like image 110
Toon Borgers Avatar answered Nov 14 '22 21:11

Toon Borgers