如何解决无法将 XSPF 播放列表插入 Android Q Media Provider
我正在尝试将 XSPF 播放列表从外部存储插入到 Android Q Media Provider 数据库播放列表表中。但得到异常。
JarFile jarFile = new JarFile("Hello.jar");
JarEntry jarEntry = jarFile.getJarEntry("com/perjoker");
异常:
public static void insertXSPFPlayListTable(Context context,MediaFile file) {
//insert audio_playlists table
Uri uri = MediaStore.Files.getContentUri("external");
context.getContentResolver().delete(uri,"_data = ?",new String[]{file.getFilePath()});
ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.Audio.Playlists.DATA,file.getFilePath());
contentValues.put(MediaStore.Audio.Playlists.DATE_MODIFIED,file.getLastModified());
contentValues.put(MediaStore.Audio.Playlists.NAME,file.getFileName());
Uri insertUri = context.getContentResolver().insert(
MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,contentValues);
if (insertUri != null) {
int mPlaylistId = -1;
Cursor c = context.getContentResolver().query(insertUri,PROJECTION_PLAYLIST,null,null);
if (c != null) {
mPlaylistId = c.getInt(c.getColumnIndex(MediaStore.Audio.Playlists._ID));
c.close();
}
}
int newId = Integer.parseInt(insertUri.getLastPathSegment());
file.setId(newId);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。