Read My Whole Code. It is working perfectly on every Phone except Marshmallow
and Lollipop
. In Marshmallow
and Lollipop
p
As,suggested by @CommonsWare -
Camera App do not need to return uri.
Also,
You need to tell Camera app where to write image.
So, i replaced my code with-
final Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
pictureUri=getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,pictureUri);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
and in onActivityResult
-
case REQUEST_IMAGE_CAPTURE:
if (resultCode==RESULT_OK){
String picturePath="";
String column_Name= MediaStore.Images.Media.DATA;
if (data!=null){
if (data.getData()!=null){
picturePath=getPathfromUri(column_Name,data.getData());}
else {
picturePath= pictureUri.getPath();
}
}
else {
picturePath= pictureUri.getPath();
}}