Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Why does this crash on actual device if photo is taken in landscape when it returns to the activity?
This works perfect in the Genymotion emulator, it also works perfect if i take a picture in portrait orientation, however when i take the picture in landscape (the normal photo orientation) the app crashes when it gets back to the activity. There seems to be a null pointer exception...
java.lang.NullPointerException at com.websitedesigns.zero.three.ribbit.FriendsFragment$1.done(FriendsFragment.java:77) at com.parse.FindCallback.internalDone(FindCallback.java:45) at com.parse.FindCallback.internalDone(FindCallback.java:31) at com.parse.Parse$6$1.run(Parse.java:975) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5102) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method)
It seems to be when the FriendsFragment tries to getListView().getContext() in the ArrayAdapter creation, i tried switching it to getActivity() and got the same results.
I also searched and tried moving the code from onResume to onActivityCreated and got the same results.