[英]Using MediaStore in Android studio to limit the number of songs in a playlist
I'm an absolute beginner in Java and Android Studio and I am trying to edit an open source music player using Android Studio.我是 Java 和 Android Studio 的绝对初学者,我正在尝试使用 Android Studio 编辑开源音乐播放器。 The app is currently creating a "last added" playlist and sorting the songs by date using MediaStore.Audio.Media.DATE_ADDED Is there a way to limit the number of songs in this playlist?
该应用程序当前正在创建“最后添加”播放列表,并使用 MediaStore.Audio.Media.DATE_ADDED 按日期对歌曲进行排序。有没有办法限制此播放列表中的歌曲数量?
I hope this description is precise enough..我希望这个描述足够准确..
Thank you:)谢谢:)
You have to set Limit
in sortOrder parameter of contentResolver
query.您必须在
contentResolver
查询的 sortOrder 参数中设置Limit
。
String sortOrder = MediaStore.Audio.Media.DATE_ADDED + " DESC LIMIT 1";
Cursor cur = getContentResolver().query(uri, null, null, null, sortOrder);
GGK GGK
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.