Calling context.getResources() returns null

前端 未结 1 959
日久生厌
日久生厌 2020-12-17 17:38

So I am trying to get a string resource in my project but when I called context.getResources().getString(...), I get a NullPointerException. In deb

相关标签:
1条回答
  • 2020-12-17 17:58

    If I had to guess, you are trying to call this in an initializer. Do not attempt to use getResources() before the super.onCreate() call in your activity returns.

    0 讨论(0)
提交回复
热议问题