bhalaji
bhalaji

Reputation: 137

How to find Internal(Default Phone Storage ) and External Storage(Removable sd card) in android?

My Motorola Phone has 12GB internal storage and Removable Sd card feature.

In DDMS file explorer my internal phone storage(12GB) is mounted as sdcard and my removable sdcard is mounted as sdcard-ext.

Using "Environment.getExternalStorageDirectory().getAbsolutePath()" method i can able to get the directory "/mnt/sdcard". Is there is any method through which i can find the absolute path of my removable sdcard?... ie.,which will return me "/mnt/sdcard-ext"

Upvotes: 4

Views: 2416

Answers (2)

Neeraj Singh
Neeraj Singh

Reputation: 668

Try this code its return all storage folder name.

Check My post here:

https://stackoverflow.com/a/38930531/1733810

Don't forget to add permission.

Getting access to external storage

In order to read or write files on the external storage, your app must acquire the READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE system permissions. For example:

<manifest ...>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    ...
</manifest>

Upvotes: 0

user658042
user658042

Reputation:

The Android framework currently supports only one mass storage device, so it's hard to manage multiple (you could try to parse /proc/mounts to get all mounted devices). But you can use Motorolas API that they built because of that fact.

Check out the Motorola "External" Storage API.

Upvotes: 5

Related Questions