I have an android app that uses the camera to take photos and show in ImageView
, except that the picture taken is not saved in the gallery. I would like to know how to save the image in the gallery and get the path of this saved image as I need it to use in another function. Here is the code I've done so far:
public class Capturar extends AppCompatActivity{
private static final int CAMERA = 1;
private ImageView imageView;
private String caminhoDaImagem;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_capturar);
imageView = (ImageView) findViewById(R.id.ivImg);
}
public void usarCamera(View view) {
Intent it = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(it, CAMERA);
}
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == CAMERA){
if(resultCode == RESULT_OK){
Bitmap bitmap = (Bitmap)intent.getExtras().get("data");
imageView.setImageBitmap(bitmap);
}
}
}
NOTE: What I want to get is the REAL image taken by the camera. Of the way it is in the code I posted, what is being shown in ImageView
is just a temporary thumbnail generated and not the actual photo.