app/src/main/java/com/example/iamatourist/MainActivity.java
private void openCameraIntent() throws IOException {
        Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (i.resolveActivity(getPackageManager()) != null) {
            File photoFile = null;
            try {
                doPermissions(WRITE_REQUEST_CODE);
                //if (canWFiles) photoFile = makeImageFile();
                photoFile = makeImageFile();
            } catch (IOException ex) {
                Toast.makeText(this, "File make failed", Toast.LENGTH_SHORT).show();
                System.out.println(ex);
                return;
            }
            if (photoFile != null) {
                Uri photoUri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".provider", makeImageFile());
                i.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
                startActivityForResult(i, CAMERA_REQUEST_CODE);
            } else {
                Toast.makeText(this, "Photofile = null", Toast.LENGTH_SHORT).show();
            }
        }
    }
/**
     * This method, and makeImageFile() were sourced from:
     * https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en
     * <p>
     * The purpose of this method is to handle the app switching to the camera, and facilitating the return.
     *
     * @throws IOException if the file cannot be made
     */


@throws IOException if the file cannot be made
@throws IOException if the file cannot be made
private void openCameraIntent() throws IOException {
        Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (i.resolveActivity(getPackageManager()) != null) {
            File photoFile = null;
            try {
                doPermissions(WRITE_REQUEST_CODE);
                photoFile = makeImageFile();
            } catch (IOException ex) {
                Toast.makeText(this, "File make failed", Toast.LENGTH_SHORT).show();
                System.out.println(ex);
                return;
            }
            if (photoFile != null) {
                Uri photoUri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".provider", makeImageFile());
                i.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
                startActivityForResult(i, CAMERA_REQUEST_CODE);
            } else {
                Toast.makeText(this, "Photofile = null", Toast.LENGTH_SHORT).show();
            }
        }
    }
private void openCameraIntent ( ) throws IOException { Intent i = new Intent ( MediaStore . ACTION_IMAGE_CAPTURE ) ; if ( i . resolveActivity ( getPackageManager ( ) ) != null ) { File photoFile = null ; try { doPermissions ( WRITE_REQUEST_CODE ) ; photoFile = makeImageFile ( ) ; } catch ( IOException ex ) { Toast . makeText ( this , "File make failed" , Toast . LENGTH_SHORT ) . show ( ) ; System . out . println ( ex ) ; return ; } if ( photoFile != null ) { Uri photoUri = FileProvider . getUriForFile ( MainActivity . this , BuildConfig . APPLICATION_ID + ".provider" , makeImageFile ( ) ) ; i . putExtra ( MediaStore . EXTRA_OUTPUT , photoUri ) ; startActivityForResult ( i , CAMERA_REQUEST_CODE ) ; } else { Toast . makeText ( this , "Photofile = null" , Toast . LENGTH_SHORT ) . show ( ) ; } } }
This method, and makeImageFile() were sourced from:
 https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en
 <p>
 The purpose of this method is to handle the app switching to the camera, and facilitating the return.
This method and makeImageFile () were sourced from : https : // inthecheesefactory . com / blog / how - to - share - access - to - file - with - fileprovider - on - android - nougat / en <p > The purpose of this method is to handle the app switching to the camera and facilitating the return .
//if (canWFiles) photoFile = makeImageFile();