@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_formulario); helper = new FormularioHelper(this); Aluno alunoSelecionado = (Aluno) getIntent().getSerializableExtra(ListaAlunosActivity.ALUNO_SELECIONADO); if (alunoSelecionado != null) { helper.colocaNoFormulario(alunoSelecionado); } ImageView fotoButton = helper.getFotoButton(); fotoButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { localArquivoFoto = getExternalFilesDir(null) + "/" + System.currentTimeMillis() + ".jpg"; Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(localArquivoFoto))); startActivityForResult(intent, CAMERA_REQUEST_CODE); } }); }