I tried this:
public String getFilename() {
File file = new File(Environment.getExternalStorageDirectory(), "Test2");
if (!file.exists()) {
file.mkdirs();
}
String uriSting = (file.getAbsolutePath() + "/" + "IMG_" + System.currentTimeMillis() + ".png");
return uriSting;
}
I tried changing the second line to:
File file = new File("sdcard/Test2");
But still the directory is being created in device storage and not on external sd card.