Reputation: 1548
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 ?
Upvotes: 0
Views: 896
Reputation: 24998
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
Upvotes: 1
Reputation: 1691
getExternalStorageDirectory ()
will give you the path to (usually) an SD card, so you can you this in your code.
Upvotes: 1