How to capture photo automatically in android phone?

后端 未结 3 1902
刺人心
刺人心 2021-01-07 05:04

I have developed an android application. In that i have used front facing camera functionality. Its working fine but I need to auto capture. i.e. without click shutter butto

3条回答
  •  星月不相逢
    2021-01-07 05:44

    write this code in on create to auto capture image

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom__camera_activity);
        mCamera = getCameraInstance();
        mCameraPreview = new CameraPreview(this, mCamera);
        FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
        preview.addView(mCameraPreview);
    
    
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
    
       {
    
    
    
                    mCamera.takePicture(null, null, mPicture);
    
                }
    
    
        }
        }, 5500);
        }
    

提交回复
热议问题