但我现在被困住了.如何使用媒体商店获取最近添加的(最近添加的)歌曲?
问候,
Niral
private voID playRecentlyAdded() { // do a query for all songs added in the last X weeks int X = MusicUtils.getIntPref(this,"numweeks",2) * (3600 * 24 * 7); final String[] ccols = new String[] { MediaStore.Audio.Media._ID}; String where = MediaStore.MediaColumns.DATE_ADDED + ">" + (System.currentTimeMillis() / 1000 - X); Cursor cursor = MusicUtils.query(this,MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,ccols,where,null,MediaStore.Audio.Media.DEFAulT_SORT_ORDER); if (cursor == null) { // Todo: show a message return; } try { int len = cursor.getCount(); long [] List = new long[len]; for (int i = 0; i < len; i++) { cursor.movetoNext(); List[i] = cursor.getLong(0); } MusicUtils.playAll(this,List,0); } catch (sqliteException ex) { } finally { cursor.close(); }}总结
以上是内存溢出为你收集整理的Android:最近使用媒体商店添加了歌曲列表全部内容,希望文章能够帮你解决Android:最近使用媒体商店添加了歌曲列表所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)