Android orientation - problems with intentions (camera)

Here is an interesting ...

I have an application that I am writing for devices running Android 2.3.3 and higher.

It has a main action that triggers the camera through Intent.

If the user presses a button to start the camera; then takes a picture; then clicks "Finish" to return to the main action - the application works fine and displays a new image in the representation of the image in the main action.

however, if the user uses the main action in portrait orientation; then presses the button to open the camera’s intention and change the orientation to the landscape; then click Finish to return to the main action - the application crashes

but then ... however, if the user uses the main action in portrait orientation; then presses the button to open the camera’s intention and change the orientation to the landscape; then change the orientation back to the portrait (in the camera) before pressing the “do” button to return to the main action - then the application continues to work normally.

I tried: I changed the manifest file to make the application (main action) navigate in the portrait (I also deleted it) I added this line to the main action, trying to handle re-drawing activity on it, returning from the camera’s intent:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

, nullpointer - , , , , , .

, .

+5
3

, Activity . , , Activity, , , , , NullPointerException.

onSaveInstanceState() . Bundle, onCreate(), Activity .

- , , .

. http://developer.android.com/reference/android/app/Activity.html#ConfigurationChanges ( , , ).

+3

, , , ,

android:configChanges="orientation|keyboardHidden" 
+1

Android, Samsung S3 S4, . , , ​​ PORTRAIT, LANDSCAPE, PORTRAIT.

Android. Re- . Null Pointer. , configChanges .

android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"

onSaveInstanceState(), @Spinner .

0

All Articles