小编xva*_*var的帖子

Android系统.自定义意图选择器

我想知道,有没有办法选择使用Intent.createChooser方法的行为?例如,我有一个图像,我想通过电子邮件发送,如果它被选中(第一个选项).在第二个选项,我想发送sms此图像上的链接(为此我需要复杂的操作 - 上传图像到服务器,检索下载链接,我想在其中sms,并将其粘贴到sms)

你能否提出任何建议,我该怎样做才能完成第二项任务?

我相信我可以发送带有这样的图像的电子邮件:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
emailIntent.setType("application/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{textMail}); 
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Some Subj"); 
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Some Extra Text"); 
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(fileUri));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
Run Code Online (Sandbox Code Playgroud)

UPD:我意识到,我真正需要的是拦截用户点击,如果sms是在意图选择器中选择的话.那么,问题是如何实现它?

android android-intent

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

android-intent ×1