Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThang Pham Quoc
73 PointsRuntime exception: java.lang.NullPointerException: storage == null
I got this exception while still can retrieving and displaying the JSONObject to the log. According to answers on stackoverflow, this exception related to putting an empty array to the ArrayAdapter. But I tried to comment the code of ArrayAdapter as well as keep the ArrayAdapter getting data from string.xml ( like in previous video ) but the exception still shows
Code at MainListActivity.java:54 : GetBlogPostTask getBlogPostTask = new GetBlogPostTask();
Exception content:
"12-17 05:12:55.723 2422-2422/vn.fall.thangpq.blogreader E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: vn.fall.thangpq.blogreader, PID: 2422 java.lang.RuntimeException: Unable to start activity ComponentInfo{vn.fall.thangpq.blogreader/vn.fall.thangpq.blogreader.MainListActivity}: java.lang.NullPointerException: storage == null at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Caused by: java.lang.NullPointerException: storage == null at java.util.Arrays$ArrayList.<init>(Arrays.java:38) at java.util.Arrays.asList(Arrays.java:155) at android.widget.ArrayAdapter.<init>(ArrayAdapter.java:128) at vn.fall.thangpq.blogreader.MainListActivity.onCreate(MainListActivity.java:54) at android.app.Activity.performCreate(Activity.java:5933) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)"