0

I got the both the external and internal(phone memory ) SD card in listing in my application but along with that i got some more folder and i don't want them so how can i limit to external and internal SD card only in listing...

i provided the root directory which is /storage and it displays whole the folder...

or can some one tell me how to get external sd card programmaticaly

i have tried the usual way File file = Environment.getExternalStorageDirectory();

given by android but it returned only internal path .

Virag Brahme
  • 2,062
  • 1
  • 20
  • 32
Helen Fog
  • 11
  • 2
  • http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory(). check the docs and the note under `getExternalStorageDirectory ()`. – Raghunandan Aug 02 '13 at 06:07
  • not possible it'll return external path – Shakeeb Ayaz Aug 02 '13 at 06:08
  • The other folders you got should just be USB drives... you should be able to filter them using (file.length() > 0) and/or file.canRead(). Read my answer here: http://stackoverflow.com/questions/11281010/how-can-i-get-external-sd-card-path-for-android-4-0/19831522 – Paolo Rovelli Nov 07 '13 at 09:15
  • In any case, instead of using the hard-coded path "/storage", use: Environment.getExternalStorageDirectory().getParent()! – Paolo Rovelli Nov 07 '13 at 09:17

1 Answers1

1

Environment.getExternalStorageDirectory() it returns sd card path but depends on the device

for better under standing check Find an external SD card location

Community
  • 1
  • 1
Tarsem Singh
  • 14,139
  • 7
  • 51
  • 71