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!
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 trial
Marcel Rob10,282 Points
The Uri memeber variable gets set to null when onActivityResult gets called
so , the mMediaUri gets correctly set to the path in which the picture will be saved after it is taken , but after i take the picture and the device gets back in onActivityResult the mMediaUri variable is null and the app crashes . I think this is because when the camera starts the screen rotates for some reasons . I have read somewhere that on screen roatation the activity recreats . I think that is the point where the mMediaUri loses its value . How can I solve this ??
You should really post some code as well as the error. As for the screen orientation, a possible solution is to make the app stay in portrait mode only. Do do this, add the
android:screenOrientation:="portrait" property to your manifest.