ANDROID: How do I download a video file to SD card?

后端 未结 2 1990
孤城傲影
孤城傲影 2020-12-01 01:31

I have a video file on a website in .MP4 format and I want to allow the user to be able to download the video to their SD card by clicking a link. Is there an easy way to d

2条回答
  •  离开以前
    2020-12-01 02:16

    Never hardwire a path, particularly to external storage. Your path is wrong on many devices. Use Environment.getExternalStoragePath() to get the root of external storage (which may be /sdcard or /mnt/sdcard or something else).

    Be sure to create your subdirectory, using the File object you get back from Environment.getExternalStoragePath().

    And, finally, don't just say "but its not working". We have no idea what "but its not working" means in your case. Without that information, it is very difficult to help you.

提交回复
热议问题