android - 如何将 url 放在 string.xml 中?

标签 android string

我像这样将 url 存储在字符串中

 <string name="selfie_smile" formatted="false" >http://hksevens.cathaypacific.com/en/smile?utm_source=mobile_app_android&utm_medium=internal&utm_content=smile&utm_campaign=HK7s</string>

这将在我的浏览器中输出 %26 而不是 &

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getActivity().getResources().getString(R.string.event_win)));

startActivity(browserIntent);

当我发布到 facebook 时也一样,我应该更改什么来修复它?谢谢

最佳答案

尝试将 & 替换为 &
原因是它会认为“&”号之后的所有内容都是“&”号字符代码。

关于android - 如何将 url 放在 string.xml 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21836638/

相关文章:

android - 设置 ListView 大小 Android

mysql - 字符串 "yyyy-mm"到 "mmm"在 MySQL 中转换为月份

coffeescript 中类似 python 的字符串插值

android - 如何存储Google ARCore主播的位置?

android - 即使我在 .bashrc 中设置了 CHROME_EXECUTABLE,Flutter doctor 也无法在 android studio 中找到 CHROME_EXECUTABLE

java - Android:扫描获取 WiFi 列表 - ListView 未出现

android - GridView中第一项的imageView onClick事件无法工作或延迟

c# - 字符串格式正确使用

java - ArrayList抛出 "java.lang.ArrayIndexOutOfBoundsException"

c - printf() 函数如何处理使用全局缓冲区的函数返回的字符串?