简体   繁体   中英

How can I create a filepath for for scanned images in android studio and add to SQL database?

I am creating an app in Android Studio where I use an external fingerprint scanner to collect fingerprint images. The only purpose of the app is to store the scanned image along with custom data for each image in a SQL database in order to use the photos for an image processing project. I am using this library https://github.com/shodgson/uareu that allows me to take a photo with the scanner which works perfectly. My problem is how I can create a filepath for the image and put it in an SQL database along with custom data I have added.I tried to implement this method: https://developer.android.com/training/camera/photobasics#java without any luck.

if you want to store an image to your application and user can't see that you can use internal storage .
internal storage is a place in your phone that just your app can access that and user can't.
you can use below pseudo code to access to internal storage and create your image file with appropriate suffix for example .jpg.jpeg and another.
at final you must write your image to output stream of new file.

//this is internal storage file
    File file = getFilesDir();

    File ImageFile = new File(file.getAbsolutePath()+"/"+newFileName.suffix);
    try
    {
        ImageFile.createNewFile();
        FileOutputStream fos = new FileOutputStream(ImageFile);

        //write your image to file output stream

    } catch (IOException e) {
        e.printStackTrace();
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM