Issue
I always get NullPointerException
whenever I call:
getApplicationContext().getResources().getStringArray(R.array.days);
I called it from DialogFragment
in my Activity
. I also tried using getActivity()
, but that didn't work for me too. Does anybody have any idea about this problem?
Solution
Try this:
If you write this in a fragment:
String[] days = getActivity().getResources().getStringArray(R.array.days);
If you write this in an activity:
String[] days = this.getResources().getStringArray(R.array.days);
Answered By - Hussein El Feky
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.