【发布时间】:2016-09-29 04:25:56
【问题描述】:
我想知道如何将超链接和纯文本连接在一起发送(例如 Play 商店中应用程序详细信息页面中的共享按钮)。我有这种情况,我正在我的 android 应用程序中设计一个共享按钮,单击该按钮应该将用户带到任何短信应用程序(我已经这样做了Intent.createChooser())。我的问题是我要么得到一个关于使用Intent.setType(text/plain) 的纯文本,要么只是一个使用Intent.setType(text/html) 的超链接,在这种情况下,我只有几个应用程序可供选择(Gmail、Drive 等)。以下是我的代码:
Intent sharing_intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sharing_intent.setType("text/*");
sharing_intent.putExtra(Intent.EXTRA_SUBJECT,"Profile Changer");
String app_link ="market://details?id=" + getPackageName();
String hyperlink="<a href=\""+ app_link +"\">"+app_link+"</a>";
String share_app_text= Html.fromHtml(hyperlink) + "\nHey! Download this application.";
sharing_intent.putExtra(Intent.EXTRA_TEXT,share_app_text);
startActivity(Intent.createChooser(sharing_intent,"Recommend via"));
有人可以告诉我如何解决这个问题并完成了吗?提前致谢
【问题讨论】:
标签: android android-intent hyperlink plaintext