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.
精彩评论