簡體   English   中英

如何在Android中查找歌曲標題,藝術家姓名,以便我可以在應用程序中分別顯示所有屬性?

[英]How to find the song title, artist name in android so that I can display all the attributes separately in my app?

我正在嘗試使用MediaPLayer類和所有這些東西來創建Media Player應用程序。 我能夠在一行中顯示歌曲文件名。 我發現很難分開歌曲標題,歌曲名稱,電影名稱並將其分別顯示在TextView

您需要在問任何問題之前通過互聯網搜索。

     String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
     String[] projection = { MediaStore.Audio.Media._ID,
             MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.TITLE,
             MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.DISPLAY_NAME,
             MediaStore.Audio.Media.DURATION};

     cursor = this.managedQuery(
             MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection,null, null);

     private List<String> songs = new ArrayList<String>();

     while(cursor.moveToNext()){
         songs.add(cursor.getString(0) + "||" + cursor.getString(1) + "||" +
                 cursor.getString(2) + "||" + cursor.getString(3) + "||" +
                 cursor.getString(4) + "||" + cursor.getString(5));
     }

鏈接以查看此,用於自定義列表視圖

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM