NullPointerException trying to access a String resource

后端 未结 3 986
耶瑟儿~
耶瑟儿~ 2021-01-18 07:56

I have the following /res/values/uris.xml



blahblah         


        
3条回答
  •  广开言路
    2021-01-18 08:46

    First of all to clear that up. You don't have to have all your strings in strings.xml. Period.

    Emmanuels answer is partially right. You have to get the string inside your onCreate() method when the context is initialized. His answer is only partially correct since he also mentioned that you have to have the strings inside the strings.xml which is not true.

提交回复
热议问题