Vote count:
0
I want to create a new folder/directory called lists but it just keeps on failing, if anyone had any suggestions that would be greatly appreciated. Thank you.
File file = new File(this.getFilesDir() +File.separator +"Lists");
if(file.mkdirs()){
System.out.println("Directory success");
}else{
System.out.println("Directory failed!");
}
System.out.println(file.getAbsolutePath());
if(file.isDirectory()){
System.out.println("File is a directory");
File lists[] = file.listFiles();
String names[] = new String[lists.length];
if(lists.length >0){
for(int i = 0; i < lists.length; i ++){
names[i] = lists[i].getName();
}
}else{
names[0] = "Create New List";
}
}else{
System.out.println("File is not a directory");
}
asked 36 secs ago
Aucun commentaire:
Enregistrer un commentaire