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.
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.