How do you write to a folder on an SD card in Android?

后端 未结 4 1392
深忆病人
深忆病人 2020-11-22 07:50

I am using the following code to download a file from my server then write it to the root directory of the SD card, it all works fine:

package com.downloader;         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 08:32

    In order to download a file to Download or Music Folder In SDCard

    File downlodDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);// or DIRECTORY_PICTURES
    

    And dont forget to add these permission in manifest

      
    

提交回复
热议问题