-1

I am creating folder with following code:

File f = new File(Environment.getExternalStorageDirectory(), folder_main);
if (!f.exists()) {
    f.mkdirs();
    this.showDialog("Done");
}
else{
    this.showDialog("Exist");
}

This code show Exist and Done correctly, but when I go to sd card with file explorer, I cannot see created folders. Why and how to make it work?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Majid Abbasi
  • 1,531
  • 3
  • 12
  • 22

1 Answers1

1

I mean, try this(make sure f currently doesn't exist):

File f = new File(Environment.getExternalStorageDirectory(), folder_main);
if (!f.exists() && f.mkdirs()) {
    sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(f)));
    this.showDialog("Done");
}else{
    this.showDialog("Exist");
}
Lym Zoy
  • 951
  • 10
  • 16