Android : Saving Files to SD Card

前端 未结 2 1999
故里飘歌
故里飘歌 2020-12-11 22:13

I am trying to save a file out from within my app to the external storage of a device. Specifically, I am trying to save a sound out.

I\'ve followed every \'tutoria

相关标签:
2条回答
  • 2020-12-11 22:51

    This answer should help: Permission to write on SD card android . Don't forget that you need to declare in your Android.xml file <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    0 讨论(0)
  • 2020-12-11 23:01

    Are you absolutely certain the file isn't being saved to the SD card? I thought I was having the same problem. It turned out that I was saving correctly to the SD card the whole time, but the gallery wasn't being refreshed to show the files I had just saved. Use Astro File Manager to make sure the file isn't already being saved to the card. If this is the problem, add this line to refresh the gallery:

    sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
                    + Environment.getExternalStorageDirectory())));
    
    0 讨论(0)
提交回复
热议问题