Android DownloadManager illegalstateexception unable to create directory

后端 未结 2 2012
失恋的感觉
失恋的感觉 2020-12-17 20:04

I\'m making android app which is using DownloadManager. I want to download file into folder which I made. But this sources don\'t operate. And happen IllegalstateException.

2条回答
  •  春和景丽
    2020-12-17 20:39

    What can I do?

    If you read the documentation for setDestinationInExternalPublicDir(), you will see that the first parameter is "the directory type to pass to getExternalStoragePublicDirectory(String)". That needs to be one of the constants defined on the Environment class, like Environment.DIRECTORY_DOWNLOADS. You are passing something else, which is not supported.

提交回复
热议问题