Required mkdir operation with android studio 3.4 and sdk version 28

71
May 05, 2019, at 04:20 AM

I have developed an android app with Android Studio 2.2.2 and the SDK version was 21. I have updated Android Studio 3.4 and SDK 28. Now I am facing problem to create directory at external storage. mkdir is not working.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
private void makeAppDir(){
        File dir = new File(Environment.getExternalStorageDirectory() + Config.APP_TEMP_DIR_AT_DEVICE);
        dir.mkdir();
    }
Answer 1

Do it like this :

String folder_main = "NewFolder";
File f = new File(Environment.getExternalStorageDirectory(), folder_main);
if (!f.exists()) {
    f.mkdirs();
}

If you wanna create another folder into that :

File f1 = new File(Environment.getExternalStorageDirectory() + "/" + folder_main, "product1");
if (!f1.exists()) {
    f1.mkdirs();
}
READ ALSO
Is it possible for a composition and aggregation to share a part?

Is it possible for a composition and aggregation to share a part?

I'm creating a UML design class diagram where my classes "Borger" (danish) ended up being a part to two other classes (wholes) :

37
How can I integrate Tally with My website [on hold]

How can I integrate Tally with My website [on hold]

Is there any way where we can get the data of tally and load it into database and use it from tally as well as website?

35
Any xhtml or primefaces attribute/property to reshuffle columns automatically

Any xhtml or primefaces attribute/property to reshuffle columns automatically

I already have a form with many fields on it,now I have to hide some fields in a particular case, but on hidding it there are blank spaces between columnsSo is there any attribute of xhtml or primefaces to automatically adjust in case the column is hidden

62
how to send multiple values in the form of an object to server

how to send multiple values in the form of an object to server

I have processed list of SyncStatus object's using List in a jsp page and displayed it in a browser using tablebelow is my jsp page for displaying list of objects in browser

49