Android Nで自分のアプリでカメラを動作させただけで、カメラで画像を撮ってOKをクリックすると、編集する写真がありません。ps: 'my appフォトエディタ」であり、ここで iはコードで行った変更です:。FileUriExposedExceptionアンドロイドN以降
だった:
private Uri getImageUri() {
File file = new File(Environment.getExternalStorageDirectory().getPath(), fname);
Uri tempURI = Uri.fromFile(file);
Log.e("URI", ">> " + tempURI);
return tempURI;
}
がなる:
private Uri getImageUri() {
File file = new File(Environment.getExternalStorageDirectory().getPath(), fname);
Uri tempURI = GenericFileProvider.getUriForFile(getApplicationContext(), getApplicationContext().getPackageName() + ".provider", file);
//Uri tempURI = Uri.fromFile(file);
Log.e("URI", ">> " + tempURI);
return tempURI;
}
と、この:
case R.id.ic_camera:
// root = this.getCacheDir();
galleryopen = true;
fname = "Style" + System.currentTimeMillis() + ".jpg";
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri());
startActivityForResult(cameraIntent, SELECT_CAMERA);
break;
へ:
case R.id.ic_camera:
// root = this.getCacheDir();
galleryopen = true;
fname = "Style" + System.currentTimeMillis() + ".jpg";
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri());
startActivityForResult(cameraIntent, SELECT_CAMERA);
break;
と私は、私が行方不明ですかわからない、私はあなたの助けに感謝します、アンドロイド7ファイルのURI以来およそのAndroid 5.1、最終的にはあるので、あなたに