我创建了一个可以通过社交媒体、电子邮件等共享消息的应用程序。在这里我想通过字符串共享我的应用程序网址。这意味着,当触摸这个字符串时,它应该转到我在 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/