My Activity has 2 buttons, one for the camera and another one to send data to the server, the problem is that when i close the application i can't set a new image on my ImageView, and when i take a picture i can't use the "send" button. I need find a way that when i take a photo i still can use the rest of my activity, i just want to set the imageView to see the image that i got from the camera, and when i close the application, i want to be able to set a new photo (it keeps giving me a blank imageView).
Here i initialize the camera.
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
if (cameraIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
});
And here i set the imageView with the bitmap that i got from the camera.
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
setContentView(R.layout.comprovante_geral);
final ImageView photo_view = (ImageView) findViewById(R.id.photo_view);
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
photo_view.setImageBitmap(imageBitmap);
}