Camera application opens and after capturing image, camera app doesn't close. Also, I have created default directory to save image file but by default it saves into the camera folder.
private void takePicture(){
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (Util.SystemFeatures.hasCamera(getApplication())) {
if (imageFile != null) {
AppLog.showAppFlow("imagefile is not null");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
startActivityForResult(intent,CAMERA_ACTIVITY_REQUEST_CODE);
Toast.makeText(this,"opening camera",Toast.LENGTH_LONG).show();
} else {
AppLog.showAppFlow("image file is null");
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(requestCode == CAMERA_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK){
AppLog.showAppFlow("Image successfully captured");
Toast.makeText(getApplicationContext(),"Image saved in: "+imageFile.getAbsolutePath(),Toast.LENGTH_LONG).show();
startNextActivity();
}
}
private void startNextActivity(){
Intent i = new Intent(this,confirmImage.class);
startActivity(i);
}