How can I convert the android resources int to a string. eg.: android.R.string.cancel?

前端 未结 3 725
后悔当初
后悔当初 2020-12-30 21:11

How can I obtain the string value \"cancel\" from this resource int: android.R.string.cancel ?

thank you

3条回答
  •  半阙折子戏
    2020-12-30 21:33

    As indicated here: http://developer.android.com/reference/android/content/Context.html#getString(int)

    String s = context.getString(android.R.string.cancel);
    

    context can be the current activity, or any object inheriting the Context abstract class.

提交回复
热议问题