简体   繁体   中英

Why i am not able to open file picker in android 10 and showing toast Failed to create image file

我无法在 android 10 中打开文件选择器并显示 toast 无法创建图像文件...但在 android 9 中工作正常。

Because Google have made file paths outside of the App's private directories useless with their scoped storage changes in Android 10, as the picture is of a non standard file picker, I guess it has not been updated (or deprecated as you can do a lot with the builtin stuff)

See https://developer.android.com/training/data-storage

Depending on the types of files you need to use MediaStore or Storage Access Framework (SAF), details https://developer.android.com/training/data-storage/shared for files outside of your App's private directories.

As it looks like picking photos, you might be able to use Google photo app to pick.

Though as a quick fix is to temporarily opt out https://developer.android.com/training/data-storage/compatibility but this will only work until Android 11

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM