How to delete a whole folder and content?
Asked Answered
J

25

226

I want the users of my application to be able to delete the DCIM folder (which is located on the SD card and contains subfolders).

Is this possible, if so how?

Johnnie answered 9/2, 2011 at 10:32 Comment(2)
other than recursive bottom-up deletion approach?Damal
If you have a very large or complex directory you should use rm -rf directory instead of FileUtils.deleteDirectory. After benchmarking we found it was multiple times faster. Check out a sample implementation here: https://mcmap.net/q/120163/-how-to-delete-all-files-and-folders-in-one-folder-on-androidHobbema
C
331

Let me tell you first thing you cannot delete the DCIM folder because it is a system folder. As you delete it manually on phone it will delete the contents of that folder, but not the DCIM folder. You can delete its contents by using the method below:

Updated as per comments

File dir = new File(Environment.getExternalStorageDirectory()+"Dir_name_here"); 
if (dir.isDirectory()) 
{
    String[] children = dir.list();
    for (int i = 0; i < children.length; i++)
    {
       new File(dir, children[i]).delete();
    }
}
Cauley answered 9/2, 2011 at 10:45 Comment(10)
erm how to i declare what dir is?Johnnie
im basically trying to delete all the photos so doesnt matter is DCIM is not deleted as long as the photos are...so even deleting 100MEDIA the folder within this would do the jobJohnnie
you have to declare directory by using path of dicm folder:use file r=file(path);Cauley
used File dir = new File(Environment.getExternalStorageDirectory()+"/DCIM/100MEDIA");Johnnie
@chiragshah After Deleting a folder and recreating the folder resulting in creation of an unknown file with same name of folder mentioned.And if i'm trying to access that file it is throwing exception like Resource or device busy.I also checked the Properties of file where i found MD5 Signature:Operation FailurePierides
lol have a look at the answer from @teedyay, this is working :)Brig
Folder must be present on storage. If not we can check one more codition for check this. if (myDir.exists() && myDir.isDirectory())Cold
it is working but if we create same directory and filename inside the directory is same as old name it retrieve old image any solutionLois
listFiles() is betterMarcel
This code won't delete sub-dirs if the file you pass is a dir with subdirectories because you can't delete dirs with contents by using "file.delete()". To delete ALL dirs and contents (so subdirts with content too) you need to use a recursive function.Roldan
S
569

You can delete files and folders recursively like this:

void deleteRecursive(File fileOrDirectory) {
    if (fileOrDirectory.isDirectory())
        for (File child : fileOrDirectory.listFiles())
            deleteRecursive(child);

    fileOrDirectory.delete();
}
Sunburn answered 21/6, 2011 at 13:9 Comment(12)
teedyay, can you please say is your answer is efficient than chirag's. Actually I am thinking that Chirag's answer is efficient, but people gave more upvotes to you. I am new to java, so can you please guide which one should I use. Honest reply would be appreciated.Porphyroid
I've done no tests for efficiency, but I believe mine is more robust. chirag's will work for the specific case of the DCIM folder, where folders within DCIM should contain only files (i.e. folders within DCIM don't normally contain any subfolders). My version will delete folders that are nested to any depth. There's a chance that the user has modified the content of his SD card so that DCIM contains folders nested more deeply (e.g. DCIM\foo\bar\pic.jpg), in which case chirag's code will fail.Sunburn
A question a colleague asked me : What happens if a folder has a symbolic link on itself and you execute this chunk of code ?Messaline
@Messaline Give your colleague a high-five for being a genius! Well spotted! To be honest I don't know whether or not this code would respect and follow symbolic links, but if it does you'll have an infinite loop. Do you fancy testing it?Sunburn
@Sunburn I'm curious so I'd like to test it. But i dont have a lot of time right now so i cant promess it'll be soon. If somebody already have tested that (or want to test it soon). I'd be happy to know the answer :)Messaline
@Messaline No worries about symbolic links. "With symbolic links, the link is deleted and not the target of the link." from docs.oracle.com/javase/tutorial/essential/io/delete.htmlGeochemistry
what is input and what should be output ?Pitta
The input is the file or directory that you want to delete. There is no output.Sunburn
Simple and magnificent. Great code teedyay. Works perfect. First it deletes files inside the folder(or say directory)one by one, and then deletes the directory. Saves a lot of memory by preventing memory leakage.Galling
There is a possible NPE here : fileOrDirectory.listFiles() may return null if there is I/O error when reading the files. This is stated clearly in the documentation : developer.android.com/reference/java/io/File.html#listFiles()Pros
As mentioned above, fileOrDirectory.listFiles() may return null. Here is the correct way of doing it - https://mcmap.net/q/117831/-how-to-delete-a-whole-folder-and-contentEmbattled
@Geochemistry is incorrect about not needing to worry about symbolic links. That link links to a tutorial that uses java.nio.file.Files.delete (which is only available on API 26+), while this answer uses java.io.File.delete (available on all Android versions).Glory
C
331

Let me tell you first thing you cannot delete the DCIM folder because it is a system folder. As you delete it manually on phone it will delete the contents of that folder, but not the DCIM folder. You can delete its contents by using the method below:

Updated as per comments

File dir = new File(Environment.getExternalStorageDirectory()+"Dir_name_here"); 
if (dir.isDirectory()) 
{
    String[] children = dir.list();
    for (int i = 0; i < children.length; i++)
    {
       new File(dir, children[i]).delete();
    }
}
Cauley answered 9/2, 2011 at 10:45 Comment(10)
erm how to i declare what dir is?Johnnie
im basically trying to delete all the photos so doesnt matter is DCIM is not deleted as long as the photos are...so even deleting 100MEDIA the folder within this would do the jobJohnnie
you have to declare directory by using path of dicm folder:use file r=file(path);Cauley
used File dir = new File(Environment.getExternalStorageDirectory()+"/DCIM/100MEDIA");Johnnie
@chiragshah After Deleting a folder and recreating the folder resulting in creation of an unknown file with same name of folder mentioned.And if i'm trying to access that file it is throwing exception like Resource or device busy.I also checked the Properties of file where i found MD5 Signature:Operation FailurePierides
lol have a look at the answer from @teedyay, this is working :)Brig
Folder must be present on storage. If not we can check one more codition for check this. if (myDir.exists() && myDir.isDirectory())Cold
it is working but if we create same directory and filename inside the directory is same as old name it retrieve old image any solutionLois
listFiles() is betterMarcel
This code won't delete sub-dirs if the file you pass is a dir with subdirectories because you can't delete dirs with contents by using "file.delete()". To delete ALL dirs and contents (so subdirts with content too) you need to use a recursive function.Roldan
N
75

We can use the command line arguments to delete a whole folder and its contents.

public static void deleteFiles(String path) {

    File file = new File(path);

    if (file.exists()) {
        String deleteCmd = "rm -r " + path;
        Runtime runtime = Runtime.getRuntime();
        try {
            runtime.exec(deleteCmd);
        } catch (IOException e) { }
    }
}

Example usage of the above code:

deleteFiles("/sdcard/uploads/");
Nickolenicks answered 16/3, 2011 at 7:53 Comment(6)
seems good, do you know if this is synchronous or asynchronous ? The documentation doesn't say: developer.android.com/reference/java/lang/…Zephan
Bad idea. Why do it on the shell?Beanery
@SomeoneSomewhere async docs.oracle.com/javase/7/docs/api/java/lang/…Leighannleighland
Not working if file name have space. example "/storage/emulated/0/Test create/test test/". Any idea. pls helpAmyotonia
@NguyễnTrungHiếu try to put single quotes around the path. like String deleteCmd = "rm -r '" + path +"'";Babbitt
@PanamaJack thanks. I fixed it. https://mcmap.net/q/117831/-how-to-delete-a-whole-folder-and-contentAmyotonia
H
67

In Kotlin you can use deleteRecursively() extension from kotlin.io package

val someDir = File("/path/to/dir")
someDir.deleteRecursively()
Heligoland answered 3/1, 2018 at 10:5 Comment(5)
In Java you can use FilesKt.deleteRecursively(new File("/path/to/dir")); if you are using kotlin-stdlibThegn
This command will delete the "/dir" directory with the content inside or just the content inside the "/dir" directory and the directory remains there ?.Sedimentation
@Sedimentation lemme google docs for you "Delete this file with all its children.". So, directory will be deleted as well as contentsHeligoland
kotlin to the rescue!Weaver
I just used this and it seems that it worked, I believe that if you use only dir.delete() and you have content inside of the folder it doesn't delete it but this does the job in case that you have content inside of itEcru
S
21

Short koltin version

fun File.deleteDirectory(): Boolean {
    return if (exists()) {
        listFiles()?.forEach {
            if (it.isDirectory) {
                it.deleteDirectory()
            } else {
                it.delete()
            }
        }
        delete()
    } else false
}

UPDATE

Kotlin stdlib function

file.deleteRecursively()
Sumbawa answered 11/5, 2019 at 8:4 Comment(0)
I
16

use below method to delete entire main directory which contains files and it's sub directory. After calling this method once again call delete() directory of your main directory.

// For to Delete the directory inside list of files and inner Directory
public static boolean deleteDir(File dir) {
    if (dir.isDirectory()) {
        String[] children = dir.list();
        for (int i=0; i<children.length; i++) {
            boolean success = deleteDir(new File(dir, children[i]));
            if (!success) {
                return false;
            }
        }
    }

    // The directory is now empty so delete it
    return dir.delete();
}
Ibby answered 1/10, 2014 at 10:46 Comment(2)
Out of all the answers, this is the ONLY real answer which deletes the directory too after deleting the files in it.Quintus
File file = new File(Environment.getExternalStorageDirectory() + separator + "folder_name" + separator); deleteDir(file);Yes this works. Thanks :)Underwater
Q
14

Your approach is decent for a folder that only contains files, but if you are looking for a scenario that also contains subfolders then recursion is needed

Also you should capture the return value of the return to make sure you are allowed to delete the file

and include

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

in your manifest

void DeleteRecursive(File dir)
{
    Log.d("DeleteRecursive", "DELETEPREVIOUS TOP" + dir.getPath());
    if (dir.isDirectory())
    {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i++)
        {
            File temp = new File(dir, children[i]);
            if (temp.isDirectory())
            {
                Log.d("DeleteRecursive", "Recursive Call" + temp.getPath());
                DeleteRecursive(temp);
            }
            else
            {
                Log.d("DeleteRecursive", "Delete File" + temp.getPath());
                boolean b = temp.delete();
                if (b == false)
                {
                    Log.d("DeleteRecursive", "DELETE FAIL");
                }
            }
        }

    }
    dir.delete();
}
Quillen answered 20/2, 2011 at 19:35 Comment(1)
This might be easier if you use for (File currentFile : file.listFiles()) {Wifely
O
10

There is a lot of answers, but I decided to add my own, because it's little different. It's based on OOP ;)

I created class DirectoryCleaner, which help me each time when I need to clean some directory.

public class DirectoryCleaner {
    private final File mFile;

    public DirectoryCleaner(File file) {
        mFile = file;
    }

    public void clean() {
        if (null == mFile || !mFile.exists() || !mFile.isDirectory()) return;
        for (File file : mFile.listFiles()) {
            delete(file);
        }
    }

    private void delete(File file) {
        if (file.isDirectory()) {
            for (File child : file.listFiles()) {
                delete(child);
            }
        }
        file.delete();

    }
}

It can be used to solve this problem in next way:

File dir = new File(Environment.getExternalStorageDirectory(), "your_directory_name");
new DirectoryCleaner(dir).clean();
dir.delete();
Olatha answered 6/2, 2015 at 14:39 Comment(0)
A
9

You can not delete the directory if it has subdirectories or files in Java. Try this two-line simple solution. This will delete the directory and contests inside the directory.

File dirName = new File("directory path");
FileUtils.deleteDirectory(dirName);

Add this line in gradle file and sync the project

compile 'org.apache.commons:commons-io:1.3.2'  
Alleen answered 4/12, 2017 at 11:58 Comment(2)
As a 2 liner, it's simple. But installing an entire library to utilise just one of its methods seems inefficient. Use this insteadMineral
gradle insert tip saved my life.Fenske
E
8

According to the documentation:

If this abstract pathname does not denote a directory, then this method returns null.

So you should check if listFiles is null and only continue if it's not

boolean deleteDirectory(File path) {
    if(path.exists()) {
        File[] files = path.listFiles();
        if (files == null) {
            return false;
        }
        for (File file : files) {
            if (file.isDirectory()) {
                deleteDirectory(file);
            } else {
                boolean wasSuccessful = file.delete();
                if (wasSuccessful) {
                    Log.i("Deleted ", "successfully");
                }
            }
        }
    }
    return(path.delete());
}
Embattled answered 8/7, 2019 at 9:20 Comment(1)
This should be the accepted answer. Works like a charm!Judaic
H
7

If you dont need to delete things recursively you can try something like this:

File file = new File(context.getExternalFilesDir(null), "");
    if (file != null && file.isDirectory()) {
        File[] files = file.listFiles();
        if(files != null) {
            for(File f : files) {   
                f.delete();
            }
        }
    }
Haun answered 29/5, 2011 at 7:3 Comment(0)
B
5
public static void deleteDirectory( File dir )
{

    if ( dir.isDirectory() )
    {
        String [] children = dir.list();
        for ( int i = 0 ; i < children.length ; i ++ )
        {
         File child =    new File( dir , children[i] );
         if(child.isDirectory()){
             deleteDirectory( child );
             child.delete();
         }else{
             child.delete();

         }
        }
        dir.delete();
    }
}
Bergess answered 21/3, 2013 at 12:48 Comment(0)
V
5

see android.os.FileUtils, it's hide on API 21

public static boolean deleteContents(File dir) {
    File[] files = dir.listFiles();
    boolean success = true;
    if (files != null) {
        for (File file : files) {
            if (file.isDirectory()) {
                success &= deleteContents(file);
            }
            if (!file.delete()) {
                Log.w("Failed to delete " + file);
                success = false;
            }
        }
    }
    return success;
}

Source: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/FileUtils.java#414

Vierra answered 29/3, 2015 at 14:22 Comment(0)
P
4

The fastest and easiest way:

public static boolean deleteFolder(File removableFolder) {
        File[] files = removableFolder.listFiles();
        if (files != null && files.length > 0) {
            for (File file : files) {
                boolean success;
                if (file.isDirectory())
                    success = deleteFolder(file);
                else success = file.delete();
                if (!success) return false;
            }
        }
        return removableFolder.delete();
}
Pluperfect answered 9/2, 2021 at 20:21 Comment(0)
T
3
private static void deleteRecursive(File dir)
{
    //Log.d("DeleteRecursive", "DELETEPREVIOUS TOP" + dir.getPath());
    if (dir.isDirectory())
    {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i++)
        {
            File temp = new File(dir, children[i]);
            deleteRecursive(temp);
        }

    }

    if (dir.delete() == false)
    {
        Log.d("DeleteRecursive", "DELETE FAIL");
    }
}
Toby answered 13/1, 2014 at 7:28 Comment(0)
O
3

This is what I do... (terse and tested)

    ...
    deleteDir(new File(dir_to_be_deleted));
    ...

    // delete directory and contents
    void deleteDir(File file) { 
        if (file.isDirectory())
            for (String child : file.list())
                deleteDir(new File(file, child));
        file.delete();  // delete child file or empty directory
    }
Ous answered 4/8, 2014 at 16:14 Comment(0)
V
2

Simple way to delete all file from directory :

It is generic function for delete all images from directory by calling only

deleteAllImageFile(context);

public static void deleteAllFile(Context context) {
File directory = context.getExternalFilesDir(null);
        if (directory.isDirectory()) {
            for (String fileName: file.list()) {
                new File(file,fileName).delete();
            }
        }    
    } 
Verla answered 7/8, 2017 at 10:53 Comment(0)
B
2

Safest code I know:

private boolean recursiveRemove(File file) {
    if(file == null  || !file.exists()) {
        return false;
    }

    if(file.isDirectory()) {
        File[] list = file.listFiles();

        if(list != null) {

            for(File item : list) {
                recursiveRemove(item);
            }

        }
    }

    if(file.exists()) {
        file.delete();
    }

    return !file.exists();
}

Checks the file exists, handles nulls, checks the directory was actually deleted

Berley answered 20/10, 2017 at 8:25 Comment(0)
S
2
//To delete all the files of a specific folder & subfolder
public static void deleteFiles(File directory, Context c) {
    try {
        for (File file : directory.listFiles()) {
            if (file.isFile()) {
                final ContentResolver contentResolver = c.getContentResolver();
                String canonicalPath;
                try {
                    canonicalPath = file.getCanonicalPath();
                } catch (IOException e) {
                    canonicalPath = file.getAbsolutePath();
                }
                final Uri uri = MediaStore.Files.getContentUri("external");
                final int result = contentResolver.delete(uri,
                        MediaStore.Files.FileColumns.DATA + "=?", new String[]{canonicalPath});
                if (result == 0) {
                    final String absolutePath = file.getAbsolutePath();
                    if (!absolutePath.equals(canonicalPath)) {
                        contentResolver.delete(uri,
                                MediaStore.Files.FileColumns.DATA + "=?", new String[]{absolutePath});
                    }
                }
                if (file.exists()) {
                    file.delete();
                    if (file.exists()) {
                        try {
                            file.getCanonicalFile().delete();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                        if (file.exists()) {
                            c.deleteFile(file.getName());
                        }
                    }
                }
            } else
                deleteFiles(file, c);
        }
    } catch (Exception e) {
    }
}

here is your solution it will also refresh the gallery as well.

Staphylo answered 22/6, 2018 at 5:23 Comment(0)
S
2

This (Tries to delete all sub-files and sub-directories including the supplied directory):

  1. If File, delete
  2. If Empty Directory, delete
  3. if Not Empty Directory, call delete again with sub-directory, repeat 1 to 3

example:

File externalDir = Environment.getExternalStorageDirectory()
Utils.deleteAll(externalDir); //BE CAREFUL.. Will try and delete ALL external storage files and directories

To gain access to External Storage Directory, you need the following permissions:

(Use ContextCompat.checkSelfPermission and ActivityCompat.requestPermissions)

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Recursive method:

public static boolean deleteAll(File file) {
    if (file == null || !file.exists()) return false;

    boolean success = true;
    if (file.isDirectory()) {
        File[] files = file.listFiles();
        if (files != null && files.length > 0) {
            for (File f : files) {
                if (f.isDirectory()) {
                    success &= deleteAll(f);
                }
                if (!f.delete()) {
                    Log.w("deleteAll", "Failed to delete " + f);
                    success = false;
                }
            }
        } else {
            if (!file.delete()) {
                Log.w("deleteAll", "Failed to delete " + file);
                success = false;
            }
        }
    } else {
        if (!file.delete()) {
            Log.w("deleteAll", "Failed to delete " + file);
            success = false;
        }
    }
    return success;
}
Sensor answered 19/11, 2019 at 12:6 Comment(0)
P
1

Here is a non-recursive implementation, just for fun:

/**
 * Deletes the given folder and all its files / subfolders.
 * Is not implemented in a recursive way. The "Recursively" in the name stems from the filesystem command
 * @param root The folder to delete recursively
 */
public static void deleteRecursively(final File root) {
    LinkedList<File> deletionQueue = new LinkedList<>();
    deletionQueue.add(root);

    while(!deletionQueue.isEmpty()) {
        final File toDelete = deletionQueue.removeFirst();
        final File[] children = toDelete.listFiles();
        if(children == null || children.length == 0) {
            // This is either a file or an empty directory -> deletion possible
            toDelete.delete();
        } else {
            // Add the children before the folder because they have to be deleted first
            deletionQueue.addAll(Arrays.asList(children));
            // Add the folder again because we can't delete it yet.
            deletionQueue.addLast(toDelete);
        }
    }
}
Proscribe answered 15/5, 2015 at 6:20 Comment(1)
The solution is not bad, but the naming is kinda misleading.Toh
B
0

I've put this one though its' paces it deletes a folder with any directory structure.

public int removeDirectory(final File folder) {

    if(folder.isDirectory() == true) {
        File[] folderContents = folder.listFiles();
        int deletedFiles = 0;

        if(folderContents.length == 0) {
            if(folder.delete()) {
                deletedFiles++;
                return deletedFiles;
            }
        }
        else if(folderContents.length > 0) {

            do {

                File lastFolder = folder;
                File[] lastFolderContents = lastFolder.listFiles();

                //This while loop finds the deepest path that does not contain any other folders
                do {

                    for(File file : lastFolderContents) {

                        if(file.isDirectory()) {
                            lastFolder = file;
                            lastFolderContents = file.listFiles();
                            break;
                        }
                        else {

                            if(file.delete()) {
                                deletedFiles++;
                            }
                            else {
                                break;
                            }

                        }//End if(file.isDirectory())

                    }//End for(File file : folderContents)

                } while(lastFolder.delete() == false);

                deletedFiles++;
                if(folder.exists() == false) {return deletedFiles;}

            } while(folder.exists());
        }
    }
    else {
        return -1;
    }

    return 0;

}

Hope this helps.

Bedew answered 7/9, 2017 at 0:18 Comment(0)
S
0

Yet another (modern) way to solve it.

public class FileUtils {
    public static void delete(File fileOrDirectory) {
        if(fileOrDirectory != null && fileOrDirectory.exists()) {
            if(fileOrDirectory.isDirectory() && fileOrDirectory.listFiles() != null) {      
                Arrays.stream(fileOrDirectory.listFiles())
                      .forEach(FileUtils::delete);
            }
            fileOrDirectory.delete();
        }
    }
}

On Android since API 26

public class FileUtils {

    public static void delete(File fileOrDirectory)  {
        if(fileOrDirectory != null) {
            delete(fileOrDirectory.toPath());
        }
    }

    public static void delete(Path path)  {
        try {
            if(Files.exists(path)) {
                Files.walk(path)
                        .sorted(Comparator.reverseOrder())
                        .map(Path::toFile)
//                      .peek(System.out::println)
                        .forEach(File::delete);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
Shannon answered 22/6, 2018 at 19:55 Comment(0)
R
0

I'm using this recursive function to do the job:

public static void deleteDirAndContents(@NonNull File mFile){
    if (mFile.isDirectory() && mFile.listFiles() != null && mFile.listFiles().length > 0x0) {
        for (File file : mFile.listFiles()) {
            deleteDirAndContents(file);
        }
    } else {
        mFile.delete();
    }
}

The function checks if it is a directory or a file.

If it is a directory checks if it has child files, if it has child files will call herself again passing the children and repeating.

If it is a file it delete it.

(Don't use this function to clear the app cache by passing the cache dir because it will delete the cache dir too so the app will crash... If you want to clear the cache you use this function that won't delete the dir you pass to it:

public static void deleteDirContents(@NonNull File mFile){
        if (mFile.isDirectory() && mFile.listFiles() != null && mFile.listFiles().length > 0x0) {
            for (File file : mFile.listFiles()) {
                deleteDirAndContents(file);
            }
        }
    }

or you can check if it is the cache dir using:

if (!mFile.getAbsolutePath().equals(context.getCacheDir().getAbsolutePath())) {
    mFile.delete();
}

Example code to clear app cache:

public static void clearAppCache(Context context){
        try {
            File cache = context.getCacheDir();
            FilesUtils.deleteDirContents(cache);
        } catch (Exception e){
            MyLogger.onException(TAG, e);
        }
    }

Bye, Have a nice day & coding :D

Roldan answered 10/7, 2020 at 13:13 Comment(0)
S
0

This is kotlin option. It worked very well.

fun executeDelete(context: Context, paths: List<String>): Int {
    return try {
        val files = paths.map { File(it) }
        val fileCommands = files.joinToString(separator = " ") {
            if (it.isDirectory) "'${it.absolutePath}/'" else "'${it.absolutePath}'"
        }
        val command = "rm -rf $fileCommands"
        val process = Runtime.getRuntime().exec(arrayOf("sh", "-c", command))
        val result = process.waitFor()
        if (result == 0) {
            context.rescanPaths(paths)
        }
        result
    } catch (e: Exception) {
        -1
    }
}

// avoid calling this multiple times in row, it can delete whole folder contents

fun Context.rescanPaths(paths: List<String>, callback: (() -> Unit)? = null) {
if (paths.isEmpty()) {
    callback?.invoke()
    return
}

var cnt = paths.size
MediaScannerConnection.scanFile(applicationContext, paths.toTypedArray(), null) { _, _ ->
    if (--cnt == 0) {
        callback?.invoke()
    }
}
}
Songwriter answered 26/12, 2022 at 7:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.