Access string.xml Resource File from Java Android Code

前端 未结 5 1374
误落风尘
误落风尘 2021-01-30 12:25

How do you access the values in the res/values/string.xml resource file from the Android Activity class?

5条回答
  •  清酒与你
    2021-01-30 12:36

    If getString(R.string.app_name); isn't working for you, you can pass context like this:

    context.getString(R.string.app_name);
    

提交回复
热议问题