简体   繁体   English

Android哪个是存储网址的最佳方式?静态数据成员还是在String.xml中?

[英]Android Which is the best way to store URLs? Static data members or in String.xml?

I have a large number of urls (almost more than 30) in my application. 我的应用程序中有大量的URL(几乎超过30个)。 I have placed them in a class as static data members. 我把它们作为静态数据成员放在一个类中。 I want to ask is it better than storing in String.xml file? 我想问一下它是否比存储在String.xml文件中更好?

Store them as string resource if the URL will not be changed. 如果不更改URL,请将它们存储为字符串资源。 It is similar to public static final 它类似于public static final

Storing them as string resources only gives an advantage if you have different URLs for different languages/locales. 如果您为不同的语言/区域设置使用不同的URL,则将它们存储为字符串资源只会带来优势。 Otherwise there's no benefit. 否则没有任何好处。

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

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