Questions tagged [android-sdcard]

SD Card is a Secure Digital Card available with Android which acts as the External Storage Directory.

Android supports also access to an external storage system e.g. the SD card. All files and directories on the external storage system are readable for all applications.

You can get the path to the external storage system via the Environment.getExternalStorageDirectory() method. To write to the external storage system your application needs the android.permission.WRITE_EXTERNAL_STORAGE permission.
Note: Beginning with Android 4.4, that permission is not required if you're reading or writing only files that are private to your app. For more information, see the section below about saving files that are app-private.

Before you do any work with the external storage, you should always call getExternalStorageState() to check whether the media is available. The media might be mounted to a computer, missing, read-only, or in some other state.

To check for the write permisson you should check the result of the

Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)

And for the read permisson

Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) ||
Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED_READ_ONLY)

Useful links

1499 questions
-1
votes
3 answers

Making a directory in android sdcard

i m trying to create directory in sd card through this card.but it is not worked.i put write external storage permission in manifest though it is not working.need urgent help.i had put this code in try catch.but it doesn't enter in catch block.here…
Mikin Patel
  • 431
  • 2
  • 6
  • 15
-1
votes
1 answer

How to code Android app to download songs from webserver and play from sdcard

I am planning to build a media player app in Android. On clicking a link in this app, the app would first download the media (mp3 file) to the phone's sd card. Once the download is done, the player would start playing the file. I was wondering if…
kallakafar
  • 725
  • 3
  • 11
  • 27
-1
votes
1 answer

how to secure videos in SDCard (android)

Possible Duplicate: Encryption of video files? i starting new project that needs to have lot of videos storing in the sdcard but i don't want users can access this videos or share it because this is paid app i read about des encryption for…
-1
votes
1 answer

Android mass storage folder on an MK802 II?

I'm using an MK802 Mini PC running stock Android ICS. It has no external micro-sd card inserted. While connected to my PC, the device is showing as a mass storage device - which allows me to copy files to it. So far so good. Problem is, I can't…
zulfik
  • 63
  • 4
-1
votes
2 answers

How to download and store file from url on sdcard without need of scanning sdcard in android

I am facing a problem in android emulator. In my app i want to download image from url and stored in to sd card. I am able to download and store the images on sdcard but there is one problem ? When i download the images and store them, when I want…
Ani
  • 1,611
  • 4
  • 14
  • 16
-1
votes
1 answer

how to Redirect to a html file, if folder exists on Android phone SD card?

I want to redirect a user to an html file or website or path, if a folder exists in sd card ( example: sdcard/download folder ) I have used response.redirect(); but its not working at all. I want to use Java by the way. or if theres another way,…
anj
  • 76
  • 4
-2
votes
2 answers

How to get Oreo sdCard path?

I want to delete duplicate files from SD Card. So i need to access SD Card files which give me the full path. eg. /storage/0C08-291C/Android/Docs/file-sample_500kB.rtf I got the SD Card path for all Android version greater than SDK level 22 but not…
-2
votes
1 answer

Why does the application work on API 19, but does not work on API 26? Target API 28

Why does the application work on API 19, but does not work on API 26? Target API 28 Logcat: 2018-10-24 23:09:57.577 10744-10744/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.guahoo.tarotoftheday17, PID:…
Guahoo
  • 19
  • 7
-2
votes
2 answers

Android Development EXTSDCARD naming on different devices?

I have a variable that just states outright: File file = new File("/Extsdcard") Am I foolish enough to think all android devices mount an external devices in this wording? or should I be using…
user1477834
  • 65
  • 1
  • 1
  • 9
-2
votes
1 answer

Store file in android

I want to store file in android. With the following flow:- if(sd card is available){ //Store in sd card... }else{ //If sd card is not available... //Store in phone memory.. } The question is basically is there any way to access sd card and…
Sreekanth Karumanaghat
  • 3,383
  • 6
  • 44
  • 72
-2
votes
2 answers

android replace string by another string in file on sdcard

I've created Test.txt on sdcard and write string "test example" on it. after that, I replace string "test" by "etc" in Test.txt. this is my code : String origin_str, old_str , new_str; @Override protected void onCreate(Bundle…
abcd1234
  • 219
  • 4
  • 16
-2
votes
2 answers

Android INSTALL_FAILED_INSUFFICIENT_STORAGE

I know that this is a quite common issue in android development, but the thing is that I do not have an SD card on my android device, so when I write android:installLocation="preferExternal" in my manifest, I get Failure…
Swoopyy
  • 61
  • 2
  • 6
-2
votes
1 answer

How can i install an app from SD Card to device without the need to check 'Unknown source' option

How can i install an app from SD Card to device without the need to check 'Unknown source' option. can the installation from SD card can be done auto? for example: when users inserts SD Card containing only apk, the device auto run the installation…
-2
votes
1 answer

Open a file from SD card in android

To open a file from android application asset folder I used below code: InputStream fis = getApplicationContext().getAssets().open(filename); Same thing I want to open a file from SDcard... How to do?
Prasad
  • 1,375
  • 5
  • 17
  • 31
-2
votes
2 answers

Android how much free space is on each storage

I want to get the free size of (Internal and External) storage of my device. I have following storage on device like : Internal Storage, SD Card, Phone Storage, I am able to get Internal and SD Card storage, but not able to get Phone Storage.…
Harshit Rathi
  • 1,862
  • 2
  • 18
  • 25
1 2 3
99
100