0

My phone has its SD card path named as "/storage/external_SD"

But I hear different phone manufacturers name their paths differently. Like SD_card , externalMemory etc..

I am developing an app that opens the SD card contents when a filechooser is opened.

How can I set a path to open when different brands name their sd card paths differently ?

user3041058
  • 1,520
  • 2
  • 12
  • 16

2 Answers2

1

getExternalStorageDirectory () will give you the path to (usually) an SD card, so you can you this in your code.

cliffroot
  • 1,839
  • 17
  • 27
1

You are looking for the Environment class and its static method getExternalStorageDirectory.

Return the primary external storage directory.
...
In devices with multiple "external" storage directories, this directory represents the "primary" external storage that the user will interact with. Access to secondary storage is available through

An SO User
  • 24,612
  • 35
  • 133
  • 221
  • I used it. It only gives the internal memory. The emulated one to be more precise. This method returns "/storage/emulated/0" and not the desired "storage/external_SD" . So that method will not solve my problem im facing. – user3041058 Sep 05 '14 at 16:46
  • 1
    Try `System.getenv("SECONDARY_STORAGE")` and see what you get :) – An SO User Sep 05 '14 at 17:48