みんな私のアプリは、これは彼らが行ったように私は理解して、すべてで正常に動作しますが、ヌガーアンドロイドN FileUriExposedException
public void takepic(View view) {
TextView schtitle = (TextView) findViewById(R.id.Sitename);
String schname = schtitle.getText().toString();
String[] tokens = schname.split(" ");
String timeStamp = new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date());
String imageFileName = tokens[0] + "-" + timeStamp + ".jpg";
TextView myAwesomeTextView = (TextView)findViewById(R.id.filetext);
//in your OnCreate() method
myAwesomeTextView.setText(imageFileName);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
String name = imageFileName;
File file = new File(path, name);
outputFileUri = Uri.fromFile(file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, TAKE_PICTURE);
}
写真を撮るために、私は次のコードを使用し写真を撮るために株式のカメラを使用していますmarshmallowあなたは今ではパーミッションを必要とし、ファイルURIはもう使用できません
ノーガットで写真を撮る方法に関するサンプルコードは見つかりませんでした。誰かがこれを可能にするために自分のコードを変更する方法を教えてください?
は、すべてのヘルプは問題がファイルであるマーク・
'FileProvider'を使用してください:https://github.com/ commonsguy/cw-omnibus/tree/master/Camera/FileProvider – CommonsWare