超链接不适用于Android OS 5及更高版本

问题描述 投票:0回答:1

在我的应用程序中通过Intent打开Gmail。我添加了Hyperlink Intent Extra文本,它不适用于Android OS 5及更高版本,但它的工作正常OS 4.3

请问我是什么问题。请参考下面的代码。

注意:直接链接[https://www.google.co.in/]工作正常所有Android操作系统。

码:

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/html");
sharingIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("<a href=https://www.google.co.in/>Google</a>");
startActivity(Intent.createChooser(sharingIntent,"Share using"));
android gmail android-5.0-lollipop android-6.0-marshmallow android-4.3-jelly-bean
1个回答
-1
投票

尝试以下代码

 Intent share = new Intent(android.content.Intent.ACTION_SEND);
    share.setType("text/plain");
    share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);


    share.putExtra(Intent.EXTRA_SUBJECT, "Google");
    share.putExtra(Intent.EXTRA_TEXT, "https://www.google.co.in");

    startActivity(Intent.createChooser(share, "Share link!"));
© www.soinside.com 2019 - 2024. All rights reserved.