开发者

Why android Messaging app is launched when I start an ACTION_SEND intent with */* mimeType type

I look at the android Messaging App source code, the manifest file said:

  <intent-filter>
       <action android:name="android.intent.action.SEND" />
       <category android:name="android.intent.category.DEFAULT" />
       <data android:mimeType="image/*" />
   </intent-filter>
   <intent-filter>
       <action android:name="android.intent.action.SEND"开发者_如何学Python />
       <category android:name="android.intent.category.DEFAULT" />
       <data android:mimeType="video/*" />
   </intent-filter>
   <intent-filter>
       <action android:name="android.intent.action.SEND" />
       <category android:name="android.intent.category.DEFAULT" />
       <data android:mimeType="text/plain" />
   </intent-filter>

But why in my code, I start an Intent like this:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("*/*");

I see the Messaging app in the pop up dialog?


Presumably because */* is the wildcard that matches everything.

Let's flip it around. If Messaging would not match */*, then nothing would match */*, and it would be utterly pointless for you to specify it as a MIME type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜