android - 如果音乐位于外部 SD 卡中,则 Android Q 中的 ContentValues 更新失败
问题描述
我使用下面的代码将音乐类型更改为铃声。如果Android版本低于Q,它可以工作,但在Android Q中崩溃。问题是musicFile.getAbsolutePath()外部SD卡的返回路径。如果音乐位于内部存储中,则没有问题。如果音乐在外部 SD 卡中,我如何更新 contentvalue?
ContentValues contentValues = new ContentValues();
contentValues.put("_data", musicFile.getAbsolutePath());
contentValues.put("title", title);
contentValues.put("mime_type", "audio/*");
contentValues.put("is_ringtone", true);
解决方案
推荐阅读
- python - 在 Django 中的项目下列出我的任务
- ios - 如何在swift 5中获取对象数组中存在的值索引?
- gps - 面临通过 UART 连接 GPSD 的问题
- sql - 在 SQL Server 表的多行中查找重复值
- python - Python sklearn 导入错误(DLL 加载失败:系统无法访问该文件。)
- r - R(小标题)中的参数“needs_dots”
- java - Java初学者q - 迭代ArrayList,选择+删除项目问题
- java - 在月底循环遍历 Joda Time 月份
- html - How do I put one container above the other in css?
- json - Chrome 正在阻止 json 下载 - 有没有办法阻止这种情况?