Ich versuche, Wissen in Android Studio zu bekommen, um Apps so zu machen, wenn dieses Code-Snippet gefunden.wenn FileProvider in Android Studio zu verwenden ... völlig Anfänger Programmierer
enter code herestatic final int REQUEST_TAKE_PHOTO = 1;
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ex) {
// Error occurred while creating the File
...
}
// Continue only if the File was successfully created
if (photoFile != null) {
Uri photoURI = FileProvider.getUriForFile(this,
"com.example.android.fileprovider",
photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
}
}
}
ich fast den gesamten Code zu verstehen, aber ich nur verwirrt mit "FileProvider" !! was ist das? und wenn wir es benutzen?
[FileProvider] zur Verfügung gestellt (https://developer.android.com/reference/android/support/v4/ content/FileProvider.html) –