根据选择器选择的应用程序设置不同的文字给ACTION_SEND意图 [英] Set a different text to an ACTION_SEND intent according to the application selected in the chooser

查看:175
本文介绍了根据选择器选择的应用程序设置不同的文字给ACTION_SEND意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何不同的内容(不同的文字,图片/无图像...)设置为 ACTION_SEND 意图是什么?
基本上我想有一个长文本和图像的电子邮件,只是长文本Facebook和Twitter的短文本......我所知道的<一个href=\"http://stackoverflow.com/questions/5313802/android-action-send-different-texts-for-each-application\">this问题,但没有答案的问题。

 意向意图=新意图(Intent.ACTION_SEND);
intent.setType(text / plain的);
intent.putExtra(Intent.EXTRA_TEXT,我的文字);
startActivity(Intent.createChooser(意向,分享));


解决方案

简单的答案仍然有效,就是你不能做到这一点,没有办法确定哪些应用程序将要处理UR意图,这样的选择是留到用户。您可以为Facebook提供用户选择,并直接叽叽喳喳这可能是有用的。

How can I set a different content (different text, image/no image...) to an ACTION_SEND intent? Basically I'd like to have a long text and an image for an email, just the long text for Facebook, and a short text for Twitter... I'm aware of this question, but there is no answer to the question.

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "My text");
startActivity(Intent.createChooser(intent, "Share with"));

解决方案

The simple answer still stands is that u cannot do that, there is no way to identify which application is going to handle ur intent, that choice is left onto the user. You can provide user options for facebook and twitter directly which might be useful

这篇关于根据选择器选择的应用程序设置不同的文字给ACTION_SEND意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆