This commit is contained in:
Captain Arepa 2024-05-23 16:06:35 -04:00
parent 11d14f2517
commit 5aeeee0b44

View file

@ -3,6 +3,7 @@ package com.example.cameraxtestappjava.segpasscamerra;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.ImageFormat;
@ -156,7 +157,6 @@ public class Camera2NewLib {
private int mSensorOrientation;
/**
*
* @param activity: The (containing) activity where the Camera is invoked from.
* @param textureView: The View used to show the Camera preview.
* @param listener: Custom listener to deal with camera and storage permissions.
@ -169,7 +169,6 @@ public class Camera2NewLib {
}
/**
*
* @param activity: The (containing) activity where the Camera is invoked from.
* @param textureView: The View used to show the Camera preview.
* @param listener: Custom listener to deal with camera and storage permissions.
@ -714,8 +713,19 @@ public class Camera2NewLib {
* Creates the custom folder {@link Camera2NewLib#mFileFolder} where pictures are saved.
*/
public void createFolder() {
PackageManager pm = mActivity.getPackageManager();
String folderName;
try {
ApplicationInfo ai = pm.getApplicationInfo(mActivity.getPackageName(), 0);
folderName = pm.getApplicationLabel(ai).toString();
} catch (Exception e) {
Log.e(TAG, "Can't find the package name.");
folderName = "CustomCameraLibraryFolder";
}
File folder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
mFileFolder = new File(folder, "Camera2TestAppAgain");
mFileFolder = new File(folder, folderName);
if (!mFileFolder.exists()) {
mFileFolder.mkdirs();
}