May be you are not properly calling CameraIntent, try below code, hope it works:
CameraIntent
String filepath = Environment.getExternalStorageDirectory()+"/foldername/"+filename;
System.out.println("thumbnail path~~~~~~"+filepath);
File file = new File(filepath);
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, 100);
onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 100) {
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));
Bitmap bitmap;
bitmap=GlobalMethods.decodeFile(_path);//function to decode.
if (bitmap == null) {
ivPhy.setImageBitmap(bitmap);
}
else {
ivPhy.setImageBitmap(bitmap);
ivPhy.setScaleType(ScaleType.FIT_XY);
}
}
}
Manifest Permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />