Search code examples
javaandroidstorageandroid-external-storage

Access External Shared Memory in Android Studio


I want ExternalMemory/Android/data/my_package_name/files/ in Android. So how I can get it.

Here external memory refers to secondary removable storage(a.k.a SD Card).

Internal Memory/Android/data/my_package_name/files/ - getExternalFilesDir(null);

ExternalMemory/Android/data/my_package_name/files/ - ?

Is this possible to get that path?


Solution

  • File dirs [] = getExternalFilesDirs(null);
    
    if ( dirs.length < 2 )
        return;
    
    File removable = dirs[1];
    
    Log.d(TAG, "removable: " + removable.getAbsolutePath();