如何在Log中显示String常量值

How to display String constant value in the Log

我在 strings.xml 中有常量字符串值,我想显示 Log.i 中的一些这些值。我尝试了以下

Log.w(TAG, Integer.toString(R.String.bt_value));

但在 运行 时,显示的是 "R.String.bt_value"

如何正确显示该值?

如果要从 R.string.xxx(资源 xml 文件之一)检索 String,请使用 getResources().getString(id) .

Log.w(TAG, getResources().getString(R.String.bt_value));