0

I am trying out the following code in order to take a picture and save it into the app internal storage:

    private void tirarFoto(){

    Intent foto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    File dir = new File(CadastroFuncionarios.this.getFilesDir(),id.getText().toString()+".jpeg");

    output=new File(dir, id.getText().toString()+".jpeg");
    foto.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(output));
    startActivityForResult(foto,REQUEST_CAMERA);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CAMERA && resultCode == RESULT_OK) {
        Intent view = new Intent(Intent.ACTION_VIEW);
        view.setDataAndType(Uri.fromFile(output),"image/jpeg");
        startActivity(view);
        finish();
    }
}

When attempting this, I get the following error: "exposed beyond app through ClipData.Item.getUri()"

To be honest, I am not even sure this is the way to go about it. Can anyone help me achieve this?

luis2608
  • 11
  • 1

0 Answers0