code: public static void takeImage(@NonNull Activity activity, int requestCode, File outPath) {
          Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
          Uri uri = getUri(activity, outPath);
          intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
          intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
          intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
          activity.startActivityForResult(intent, requestCode);
      }
docs: Take picture.
  
  @param activity    activity.
  @param requestCode code, see {@link Activity#onActivityResult(int, int, Intent)}.
  @param outPath     file path.