开发者

Android Faster Access : Container class or xml resource

I have a list of strings (messages and urls) which I want to place in a common file. Would it be more efficient to place them in开发者_运维问答 a container class or as an xml resource?

If I want to use the strings in my xml layouts, I guess I have to put my string in an xml resource?

Edit: I know the advantages of both approaches, all I want to know is which is faster.


XML resources are actually compiled to binary form when you create your APK, so they are pretty fast. If you use resources, you can define different string for different languages (locales), versions or screen sizes, and the platform takes care of using the right one automatically. There is no reason to use a container class, use XML resources.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜