I want to send a photo taken by camera intent.
- Camera works fine
- I have path from mMediaUri.getPath() (it's correct)
- I have method to send it (postImage()) (works fine)
When I start an Intent, camera is showing up, but method postImage is not waiting until photo is taken. PostImage just loading after starting intent.
How to load postImage after photo was taken?
or
How to detect if photo was taken?
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
mMediaUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
if(mMediaUri == null){
Toast.makeText(MainActivity.this, "Problem!", Toast.LENGTH_LONG).show();
}
else {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
postImage("mail", mMediaUri.getPath());
}
}