/** * Creates a new instance of a dialog displaying the rationale for the use of the location * permission. * * <p>The permission is requested after clicking 'ok'. * * @param requestCode Id of the request that is used to request the permission. It is returned * to the {@link ActivityCompat.OnRequestPermissionsResultCallback}. * @param finishActivity Whether the calling Activity should be finished if the dialog is * cancelled. */ public static RationaleDialog newInstance(int requestCode, boolean finishActivity) { Bundle arguments = new Bundle(); arguments.putInt(ARGUMENT_PERMISSION_REQUEST_CODE, requestCode); arguments.putBoolean(ARGUMENT_FINISH_ACTIVITY, finishActivity); RationaleDialog dialog = new RationaleDialog(); dialog.setArguments(arguments); return dialog; }