如何在棉花糖中自动捕获图像?

时间:2017-03-03 11:13:31

标签: android android-camera android-camera-intent

我可以打开相机(正面和背面),但我只能使用相机按钮拍照!我想在一段时间内自动捕捉图像或倒计时。

我用它打开相机

intent = new Intent(getActivity(), Camera2Activity.class)
.putExtra("prevent_camera", CameraCharacteristics.LENS_FACING_BACK);
startActivityForResult(intent, REQUEST_FRONT_CAMERA);

Camera2Activity:

public class Camera2Activity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_camera);
        if (null == savedInstanceState) {
            getFragmentManager().beginTransaction()
                    .replace(R.id.container, Camera2BasicFragment.newInstance(getIntent().getIntExtra("prevent_camera",0)))
                    .commit();
        }
    }
}

0 个答案:

没有答案