Quantcast
Channel: Null pointer exception while loading from strings.xml in Android - Stack Overflow
Browsing latest articles
Browse All 5 View Live

Answer by Anton Tarasov for Null pointer exception while loading from...

Why don't you create a string-array instead of multiple strings? <resources> <string-array name="questions"> <item>What year did John say the Beatles were more popular than...

View Article



Answer by Ramkumar.M for Null pointer exception while loading from...

try this String value= getResources().getString(R.string.q1); for reference click here

View Article

Answer by David for Null pointer exception while loading from strings.xml in...

You should use int [] stringIds = { R.string.q1, R.string.q2... } As when you declare the string [], you call getString(id), where some context or resource is needed, but not yet initialized, that...

View Article

Answer by Pratik Butani for Null pointer exception while loading from...

You're calling getResources() from a field initializer. Something like private String mStr = getResources().getString(...); (or with drawables or other kind of resources). This is not valid, since the...

View Article

Null pointer exception while loading from strings.xml in Android

I am receiving a null pointer exception for some reason. My app crashes when trying to load strings from the strings xml file. I have no idea why there is a null pointer. Any ideas? Thanks! Quiz.java...

View Article

Browsing latest articles
Browse All 5 View Live




Latest Images