java - 如何在android中的字符串中隐藏应用程序网址

标签 java android string android-intent

我创建了一个可以通过社交媒体、电子邮件等共享消息的应用程序。在这里我想通过字符串共享我的应用程序网址。这意味着,当触摸这个字符串时,它应该转到我在 Play 商店中的应用程序。实际上我想将我的应用程序网址隐藏在这个字符串中。

但我无法完成这个任务。以下是我遵循的一些步骤。

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");

String shareBody = "Here is the share content body";

StringBuilder builder = new StringBuilder();
builder.append("**** ").append("Results").append(" ****").append("\n\n");
builder.append("Value - ").append(Val).append("\n");
builder.append("Prime - ").append(Val).append("\n");
builder.append("Status - ").append(Val).append("\n");
builder.append("Ratio - ").append(Val).append("\n");
builder.append("Result - ").append(Range).append("\n");
builder.append("https://play.google.com/store/apps/details?id=net.mobilecraft.realbasketball&hl=en");
String text=builder.toString();

sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Results");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(sharingIntent, "Share via")); 

我怎样才能隐藏这个https://play.google.com/store/apps/details?id=net.mobilecraft.realbasketball&hl=en在 String 内。

有什么想法吗?

谢谢。

最佳答案

据我所知,您不会将 URL 隐藏在字符串中。您只需传递字符串即可。现在,在接收端,客户端应用程序(邮件客户端、消息应用程序等)将自行解析字符串并将其作为可点击链接显示给用户。类似于当您简单粘贴链接时 Facebook 能够判断您发布了链接。

关于java - 如何在android中的字符串中隐藏应用程序网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38780820/

相关文章:

java - 找出字符串的排列总数

java - 接口(interface)名称可以是返回类型吗?

java - Android 服务或 Activity 可以知道哪个 Intent 打开了它吗?

C:初始化字符指针(字符串)数组并使用 fgets 遍历文件以将值放入这些字符串

javascript - 向字符串添加小数

javascript split() 数组包含

java - 在java中的链接 HashMap 中查找特定键的值

android - 如何使用 ffmpeg 编码视频以在 Android 上播放?

java - 将 switch 语句与 imageview 可见性连接起来

java - Apache POI : content in excel file gets corrupted