小编Use*_*ser的帖子

Android Camera:尝试在空对象引用上的android.hardware.Camera.getParameters()'上调用虚拟方法Android Camera Parameters

我使用了我的Fabric服务,并在运行我的应用程序的大多数设备上发现了此错误.

错误是这样的:

致命异常:java.lang.NullPointerException尝试在空对象引用上调用虚拟方法'android.hardware.Camera $ Parameters android.hardware.Camera.getParameters()'

这是我的代码:

 public class CameraActivity extends Activity implements SurfaceHolder.Callback{

    android.hardware.Camera camera;
    int moi = 0;
    @InjectView(R.id.s)
    SurfaceView surfaceView;

    @InjectView(R.id.takeaphoto)
    ImageView imageView;
    SurfaceHolder surfaceHolder;
    private Camera.Face[] mFaces;





    // Draw rectangles and other fancy stuff:
    private FaceOverlayView mFaceView;
    private int mOrientation;
    private float x1,x2;
    static final int MIN_DISTANCE = 150;
    private int mOrientationCompensation;
    private OrientationEventListener mOrientationEventListener;

    // Let's keep track of the display rotation and orientation also:
    private int mDisplayRotation;
    private int mDisplayOrientation;


    Camera.PictureCallback callback; …
Run Code Online (Sandbox Code Playgroud)

java android android-camera android-studio android-camera2

4
推荐指数
2
解决办法
1万
查看次数