public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
camera.startPreview();
auto_Focusing(camera);
final CameraSurfaceView cameraView = new CameraSurfaceView(getApplicationContext());
final FrameLayout previewFrame = (FrameLayout) findViewById(R.id.previewFrame);
previewFrame.setOnTouchListener(new OnTouchListener()//231라인
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
// if(event.getAction()==MotionEvent.ACTION_UP)
// {
// auto_Focusing(camera);
// }
return false;
}
});
Binarization(camera, holder);
}
코드는 이렇구요
증상은 앱을 실행시키면 강제로 종료됩니다.
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.FrameLayout.setOnTouchListener(android.view.View$OnTouchListener)' on a null object reference
at com.example.ai.ex.MainActivity$CameraSurfaceView.surfaceChanged(MainActivity.java:231)
PS. xml에 FrameLayout 의 id값이 previewFrame으로 되어 있습니다.