Android - Intent.setType() arguments

2019-07-10 09:07发布

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

2条回答
SAY GOODBYE
2楼-- · 2019-07-10 09:22

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

The MIME type is text/vcard

查看更多
闹够了就滚
3楼-- · 2019-07-10 09:44

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.

查看更多
登录 后发表回答