title: Why is my android activity being stopped?
body: <p>I have inherited some code from an application that I need to modify (yuck).  The activity in question implements SurfaceHolder.Callback and SensorEventListener.  This activity is for a custom Camera.</p>
  
  <p>The code works fine to autofocus, and take a picture.   Once the picture is taken, I start another activity for result to crop the image.   As soon as that activity is started, the SurfaceHolder.Callback for surfaceDestroyed is called (as expected).  At this point the existing application releases the camera (as expected).  However, when the new crop activity is launched, the original camera activity is stopped (stack trace: Instrumentation.callActivityOnStop->Activity.performStop).</p>
  
  <p>Edit:  Complete stack trace when the onStop of my activity is called:</p>
  
  <pre><code>CameraActivity.onStop() line: 784      
  Instrumentation.callActivityOnStop(Activity) line: 1219
  CameraActivity(Activity).performStop() line: 5186      
  ActivityThread.performStopActivityInner(ActivityThread$ActivityClientRecord, ActivityThread$StopInfo, boolean, boolean) line: 3003     
  ActivityThread.handleStopActivity(IBinder, boolean, int) line: 3052    
  ActivityThread.access$1000(ActivityThread, IBinder, boolean, int) line: 139    
  ActivityThread$H.handleMessage(Message) line: 1251     
  ActivityThread$H(Handler).dispatchMessage(Message) line: 99    
  Looper.loop() line: 137
  ActivityThread.main(String[]) line: 4918       
  Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] 
  Method.invoke(Object, Object...) line: 511     
  ZygoteInit$MethodAndArgsCaller.run() line: 1004
  ZygoteInit.main(String[]) line: 771    
  NativeStart.main(String[]) line: not available [native method] 
  </code></pre>
  
  <p>Because of this the camera activity is no longer active, and it doesn't receive the result from the crop activity.</p>
  
  <p>Why does destroying the surface/releasing the camera cause the Camera Activity to stop?  I must be missing something here...</p>