sd card - Android Open External Storage directory(sdcard) for storing file -
i want open external storage directory path saving file programatically.i tried not getting sdcard path. how can this?is there solution this??
private file path = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures) + "");
or
private file path = new file(environment.getexternalstoragedirectory() + "");
i tried getting path above both methods both pointing internal memory.
when open storage memory if sdcard peresent shows below-
device storage & sd memory card.
i want sd memory path through coding. have given permissions in manifest-
<uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.storage" /> <uses-permission android:name="android.permission.read_external_storage" />
i had been having exact same problem!
to internal sd card can use
string extstore = system.getenv("external_storage"); file f_exts = new file(extstore);
to external sd card can use
string secstore = system.getenv("secondary_storage"); file f_secs = new file(secstore);
on running code
extstore = "/storage/emulated/legacy" secstore = "/storage/extsdcarcd"
works perfectly!
Comments
Post a Comment