1 public static File commonDocumentDirPath(String FolderName){
2 File dir = null ;
3
4 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
5 dir = new File (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+ "/"+FolderName );
6 } else {
7 dir = new File(Environment.getExternalStorageDirectory() + "/"+FolderName);
8 }
9
10 // Make sure the path directory exists.
11 if (!dir.exists()) {
12 // Make it, if it doesn't exit
13 boolean success=dir.mkdirs();
14 if(!success) {dir=null;}
15
16
17 }
18
19 return dir ;
20
21 }
22