简体   繁体   English

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

[英]How to put the url on string.xml in android?

I store the url in string like this 我将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>

This will output the %26 instead of & in my browser 这将在我的浏览器中输出%26而不是&

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

startActivity(browserIntent);

And also the same when I post to facebook , what should I change to fix it? 当我发布到Facebook时,我应该改变什么来修复它? thanks 谢谢

Try replacing & with &amp; 尝试更换&用&amp;
The reason is that it will think everything past the ampersand is an ampersand character code. 原因是它会认为通过&符号的所有内容都是符号字符代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM