title: Can I block Android Camera rotation?
body: <p>I'm using SherlockActionBar menu in my app. Now, my whole app is set to work only in Portrait mode using on all activities:</p>
  
  <pre><code>"android:screenOrientation="portrait" 
  </code></pre>
  
  <p>Now, what happens is, I open camera from my app, I take pictures and on return I do some edit, and that works more or less fine.</p>
  
  <p>In case that I turn the camera while taking pictures on Android 2.2., during "on resume" I can see my app in Landscape mode for a tiny second, then it figures out that it should not be in Landscape it rotates back to portrait mode but doubles my action bar, I get two Icons, two menus, and then if I continue to use my app it crashes.</p>
  
  <p>Here is the log:</p>
  
  <pre><code>10-04 08:34:24.602: E/AndroidRuntime(8954): FATAL EXCEPTION: main
  10-04 08:34:24.602: E/AndroidRuntime(8954): java.lang.NullPointerException
  10-04 08:34:24.602: E/AndroidRuntime(8954):     at android.graphics.Canvas.drawBitmap(Canvas.java:1115)
  10-04 08:34:24.602: E/AndroidRuntime(8954):     at my.specapp.apps.BitmapRender.onDraw(BitmapRender.java:58)
  10-04 08:34:24.602: E/AndroidRuntime(8954):     at android.view.View.draw(View.java:6739)
  10-04 08:34:24.602: E/AndroidRuntime(8954):     at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
  10-04 08:34:24.602: E/AndroidRuntime(8954):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
  10-04 08:34:24.602: E/AndroidRuntime(8954):     at android.view.View.buildDrawingCache(View.java:6499)
  </code></pre>
  
  <p>This is most likely where second menu is drawn, and then if I continue it crashes with:</p>
  
  <pre><code>10-04 08:35:05.242: E/AndroidRuntime(8966): FATAL EXCEPTION: main
  10-04 08:35:05.242: E/AndroidRuntime(8966): java.lang.RuntimeException: Unable to start activity ComponentInfo{bla bla/bla bla.MainActivity}: java.lang.NullPointerException
  10-04 08:35:05.242: E/AndroidRuntime(8966):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
  10-04 08:35:05.242: E/AndroidRuntime(8966):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
  10-04 08:35:05.242: E/AndroidRuntime(8966):     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
  </code></pre>
  
  <p>If I do not turn the device I do not get this kind of issue, so I guess I could somehow ask device not to allow camera to turn to landscape, or I have to block that my app goes to landscape mode, and that is done through manifest, so I do not understand how to fix it.</p>
  
  <p>Any suggestions?</p>