Android - Intent.setType() arguments

2019-07-10 09:34发布

问题:

Does anyone know all available arguments for this method? Like "image/..." or "file/..."? I didn't found a clue for that list in official documentation.

Speccially, I need an intent to send contact (.vcf) file. But type "file/vcf" doesn't show me send via sms option.

sendIntent.setData(Uri.parse("sms:"))

Also didn't help

Thanks

回答1:

The Intent.setType() takes the MIME type as an argument.

The MIME type is text/vcard



回答2:

How about Intent.setAction? For example to send sms:

intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("sms:" + phonenumberhere));

Action View is kind of a generic handler in this case, but when combined with phonenumber and sms it will send text.