Capture photo sequence and save automatically on Android

Asked

Viewed 274 times

1

I am trying to use my android camera in an application so that when taking the first photo I am not redirected to the home screen.

Currently the application is as follows:Tela Inicial

When clicking on "Take calibration photos" is directed to the camera where when taking the photo is asked if I want to save the photo or repeat the process. inserir a descrição da imagem aqui

My question is: How to capture multiple images at once without having to go back to the home screen and click "Take calibration photos" again.

The following is the application code:

public class MainActivity extends AppCompatActivity {
ImageView imageView; // campo onde sera exibido a foto
Button btnCameraCalibrate;
private File arquivo;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    imageView = (ImageView) findViewById(R.id.imageView);
    btnCameraCalibrate = (Button) findViewById(R.id.btnPicturesCalibration);


    btnCameraCalibrate.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View view){

            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            //cria pasta para guardar fotos
            File pictureDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM+"/Reccoon3D");
            if(!pictureDirectory.exists()){
                pictureDirectory.mkdirs();
            }
            //nomeia a foto baseada em data e hora
            String pictureName = getCalibrationPictureName();
            File imagemCalib = new File(pictureDirectory,pictureName);
            Uri pictureUri = Uri.fromFile(imagemCalib);
            intent.putExtra(MediaStore.EXTRA_OUTPUT,pictureUri);


            startActivityForResult(intent,0);

        }
    });
}

private String getCalibrationPictureName() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
    String timestamp = sdf.format(new Date());

    return "Calibration"+timestamp+".jpg";
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){

   super.onActivityResult(requestCode,resultCode,data);
    //Bitmap bitmap = (Bitmap)data.getExtras().get("data");
    //imageView.setImageBitmap(bitmap);
     }
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.