简体   繁体   English

三星银河王牌Surfaceview /相机错误

[英]samsung galaxy ace surfaceview/ camera error

I am writting an app that is supposed to be compatible with the samsung galaxy ace. 我正在写一个应该与三星银河王牌兼容的应用程序。 I have the following code: 我有以下代码:

mPreview = (SurfaceView)findViewById(R.id.preview);
mPreview.getHolder().addCallback(this);
mPreview.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mCamera.setDisplayOrientation(0);           
mCamera = Camera.open();

It crashes at 崩溃于

mCamera.setDisplayOrientation(0);

And gives the following error: 并给出以下错误:

/AndroidRuntime(18011): Caused by: java.lang.NullPointerException

I have tried to set the value to 90, 180, 270 and 360, but nothing seems to solve this issue. 我尝试将值设置为90、180、270和360,但是似乎没有任何方法可以解决此问题。

It is because mCamera is null. 这是因为mCamera为空。

You should call setDisplayOrientation() after Camera.open() . 您应该在Camera.open()之后调用setDisplayOrientation() Camera.open()

It is written in Android developer site ( http://developer.android.com/reference/android/hardware/Camera.html ). 它是在Android开发者网站( http://developer.android.com/reference/android/hardware/Camera.html )中编写的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 相机:setDisplayOrientation功能不适用于Android 2.3.6的三星Galaxy ACE - Camera : setDisplayOrientation function is not working for Samsung Galaxy ACE with Android 2.3.6 为什么相机闪光灯无法在Samsung Galaxy Ace上关闭? - Why does the camera flash light not turn off on Samsung Galaxy Ace? 打开/关闭Samsung Galaxy Ace 2.2.1和Galaxy Tab中的相机LED /闪光灯 - Turn ON/OFF Camera LED/flash light in Samsung Galaxy Ace 2.2.1 & Galaxy Tab Samsung Galaxy ace2中的GCM注册错误,但可在模拟器中使用 - GCM registration error in Samsung Galaxy ace2 but works in emulator 应用程序不支持HTC explorer和samsung galaxy ace - App not supported by HTC explorer and samsung galaxy ace Windows 7上未显示Samsung Galaxy Ace调试模式 - Samsung Galaxy Ace Debugging Mode not showing on Window 7 Android:我无法在SurfaceView(Samsung Galaxy S GT-i9000)上使用前置摄像头拍照 - Android:I can't take a photo with the front facing camera on SurfaceView (Samsung Galaxy S GT-i9000 ) 我的应用无法正常使用三星银河王牌二人组 - My App is not working n samsung galaxy ace duos Android-将Samsung Galaxy Ace VIA蓝牙连接到NXT - Android - Connecting Samsung Galaxy Ace VIA Bluetooth to NXT 应用程序意外停止,请在三星银河王牌中重试 - The application has stopped unexpectedly try again in samsung galaxy ace
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM