I’m trying to declare some final Strings for using as keys later, but I keep getting a null pointer exception.
private final String KEY = getString(R.string.key);
This is declared at the top of my activity, before onCreate(). Does the problem stem from referring to R in the class?
The problem is, that you cannot access the
getString(..)there.Why dont you just save the int value?
and than where you need it call the
yourContext.getString(KEY);🙂