luee
luee

Reputation: 75

get external sdcard specific folder path for all android devices

Is there any common way to find the specific folder in micro SD card path all crevices? how to get this path by something like /storage/extSdCard/MYFOLDER

This is my code its only working on android 4.4.

String  securepath = secStoreSystem.getenv("SECONDARY_STORAGE");
String  defaul_directory_tpath = secStore+"/MYFOLDER";

secStoreSystem.getenv("SECONDARY_STORAGE") 

getting null value in android 4.4+ devices

Upvotes: 1

Views: 657

Answers (2)

EKN
EKN

Reputation: 1906

As per your code you are saving external storage path to string variable path but your are using path1 for getting your folder. Please check this.

Upvotes: 0

EKN
EKN

Reputation: 1906

try this

path = Environment.getExternalStorageDirectory().getAbsolutePath();

String fileName = "myFile.txt";

//getting your file/folder

File f = new File(path + File.separator + fileName);

Upvotes: 1

Related Questions