Android Open External Storage directory for storing file

0 votes

I want to open external storage directory path for saving file programatically.I tried but not getting sdcard path. How can i do this?

I want to get sd memory path through coding. I have given permissions in manifest-

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Jun 9, 2022 in Others by polo
• 1,480 points
1,678 views

1 answer to this question.

0 votes

To get the internal SD card you can use

String extStore = System.getenv("EXTERNAL_STORAGE");
File f_exts = new File(extStore);

To get the external SD card you can use

String secStore = System.getenv("SECONDARY_STORAGE");
File f_secs = new File(secStore);

On running the code

 extStore = "/storage/emulated/legacy"
 secStore = "/storage/extSdCarcd"
answered Jun 9, 2022 by nisha
• 2,210 points

Related Questions In Others

0 votes
1 answer
–1 vote
1 answer

Open file in SDCard on Android

To open a file that is on ...READ MORE

answered Jun 20, 2022 in Others by nisha
• 2,210 points
40,132 views
0 votes
1 answer

Android: how to write a file to internal storage

Android offers openFileInput and openFileOutput from the ...READ MORE

answered Nov 4, 2022 in Others by gaurav
• 23,260 points
1,915 views
0 votes
1 answer

Get files in my own file format for its own dynamic icon

Regarding MAC support, "The Mac and Windows ...READ MORE

answered Jan 8, 2019 in Others by DataKing99
• 8,250 points
1,138 views
0 votes
0 answers

Android Open External Storage directory(sdcard) for storing file

For programmatic file saving, I want to ...READ MORE

Sep 21, 2022 in Android by Edureka
• 13,620 points
1,059 views
0 votes
1 answer

Running docker on Android

According to the documentation, the Android kernel is ...READ MORE

answered Aug 1, 2018 in Docker by Kalgi
• 52,350 points
3,802 views
0 votes
1 answer

Task Canceled Exception while invoking AWS Lambda

I'm guessing either the TaskCanceledException instance is ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 58,020 points
2,486 views
0 votes
1 answer

Is there a way to run Python on Android?

YES! here’s a barcode scanner written in six ...READ MORE

answered Sep 19, 2018 in Python by Priyaj
• 58,020 points
1,039 views
0 votes
1 answer

Android Open External Storage directory(sdcard) for storing file

you can't do that. A workaround is to ...READ MORE

answered Jun 9, 2022 in Others by nisha
• 2,210 points
2,634 views
0 votes
1 answer

How can i create file at external storage in Android?

We have not had read/write filesystem access ...READ MORE

answered Jun 6, 2022 in Others by nisha
• 2,210 points
3,477 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP