user3205481
user3205481

Reputation: 21

How to hide folder in sdcard programmatically in android

I have an app with xyz.zip folder which is extracting after installation in sdcard. Folder contains a lot of files(e.g Video,audio,etc.).During installing app I wanna hide that folder and hide all items of folder. Thanks in advance.

Any answer is appreciated.

Upvotes: 2

Views: 8593

Answers (2)

FD_
FD_

Reputation: 12919

Use a function like this:

public static void hideFile(File file){
    File dstFile = new File(file.getParent(), "." + file.getName());
    file.renameTo(dstFile);
}

Please note I did not try the code, but it should at least give you the idea of how to do it.

Upvotes: 5

Manuel Allenspach
Manuel Allenspach

Reputation: 12735

If you want to hide folder in Android or any Linux based system just add . as prefix to folder or file name.

Answer stolen from here: How to hide a folder in sdcard in android

Upvotes: 2

Related Questions