Set a different text to an ACTION_SEND intent according to the application selected in the chooser [duplicate]

喜欢而已 提交于 2019-12-10 15:55:06

问题


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"));

回答1:


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



来源:https://stackoverflow.com/questions/6409931/set-a-different-text-to-an-action-send-intent-according-to-the-application-selec

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!