应用程序在更改相机旋转时崩溃

时间:2014-02-11 11:57:00

标签: android

我想要实现相机预览应用程序。当我在模拟器上进行测试然后它工作正常。但是当我在真实设备上测试时(例如nexes)然后它在旋转变化时崩溃,并且无法从图库中选择图像,但它在模拟器上运行正常  我的logcat是

    02-11 15:11:39.895: W/dalvikvm(8326): threadid=1: thread exiting with uncaught exception   
    (group=0x41542ba8)          
    02-11 15:11:39.895: E/AndroidRuntime(8326): FATAL EXCEPTION: main
    02-11 15:11:39.895: E/AndroidRuntime(8326): Process: com.photostikers, PID: 8326
    02-11 15:11:39.895: E/AndroidRuntime(8326): java.lang.RuntimeException: setParameters failed
    02-11 15:11:39.895: E/AndroidRuntime(8326):  at    
     android.hardware.Camera.native_setParameters(Native    Method)
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at  
    android.hardware.Camera.setParameters(Camera.java:1650)   
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
   com.photostikers.Preview.surfaceChanged(Preview.java:159)                        
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
     android.view.SurfaceView.updateWindow(SurfaceView.java:583)
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at  
    android.view.SurfaceView.access$000(SurfaceView.java:86)
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at  
    android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175)     
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
   android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
   android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1871)
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
   android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
   02-11 15:11:39.895: E/AndroidRuntime(8326):  at  android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
 android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)   
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at  
  android.view.Choreographer.doCallbacks(Choreographer.java:574)
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
  android.view.Choreographer.doFrame(Choreographer.java:544)
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
  android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
  02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
  android.os.Handler.handleCallback(Handler.java:733)
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
 android.os.Handler.dispatchMessage(Handler.java:95)
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at android.os.Looper.loop(Looper.java:136)
  02-11 15:11:39.895: E/AndroidRuntime(8326):  at 
 android.app.ActivityThread.main(ActivityThread.java:5017)
  02-11 15:11:39.895: E/AndroidRuntime(8326):  at java.lang.reflect.Method.invokeNative(Native 
  Method)
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at java.lang.reflect.Method.invoke(Method.java:515)
 02-11 15:11:39.895: E/AndroidRuntime(8326):  at  
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
 02-11 15:11:39.895: E/AndroidRuntime(8326):at    
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-11 15:11:39.895: E/AndroidRuntime(8326):  at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案