我注意到活动
类有两个不同的方法来得到一个字符串资源。
这可以通过使用
I noticed that the Activity
class has two different methods to get a String resource.
This is possible by using:
的getString(INT渣油)
:返回一个本地化的字符串从应用程序的包的默认字符串表
getString(int resId)
: Return a localized string from the application's package's default string table.
getResources()的getString(INT ID)
:返回与特定的资源ID关联的字符串值。任何样式的文本信息将被剥离。
getResources().getString(int id)
: Returns the string value associated with a particular resource ID. It will be stripped of any styled text information.
我不明白什么是两种方法之间的差异。谁能告诉我?
I don't understand what's the difference between both methods. Can somebody tell me?
他们是一样的Activity.getString(int)正是这么做的:
They are the same as Activity.getString(int)
does exactly that:
public final String getString(int resId) {
return getResources().getString(resId);
}
上一篇:Android的Proguard的Javascript的接口故障故障、接口、Android、Proguard
下一篇:"找不到XXX.apk"在控制台消息,同时启动应用程序在Android的lib链接找不到、控制台、应用程序、消息