I had been having the exact same problem!
To get the internal SD card you can use
String extStore = System.getenv("EXTERNAL_STORAGE");
File f_exts = new File(extStore);
To get the external SD card you can use
String secStore = System.getenv("SECONDARY_STORAGE");
File f_secs = new File(secStore);
On running the code
extStore = "/storage/emulated/legacy"
secStore = "/storage/extSdCarcd"
works perfectly!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…