遍历安卓系统的音频

版权声明:本文为博主原创文章,未经博主允许不得转载 https://blog.csdn.net/hnlgzb/article/details/88593211

            ContentResolver cr = MainActivity.this.getContentResolver();

            Cursor cursor = cr.query(
                    MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null,
                    null, "date_modified DESC");
            cursor.moveToFirst();
            String[] strings= cursor.getColumnNames();
            for (String s:strings){
                int t= cursor.getType(cursor.getColumnIndex(s));

                Log.i("YYY","--:"+s+"--:"+t);

                int id=cursor.getInt(cursor.getColumnIndex("_id"));
                long size=cursor.getLong(cursor.getColumnIndex("_size"));
                long date_added=cursor.getLong(cursor.getColumnIndex("date_added"));
                int modified=cursor.getInt(cursor.getColumnIndex("date_modified"));
                
                String data=cursor.getString(cursor.getColumnIndex("_data"));
                String display_name=cursor.getString(cursor.getColumnIndex("_display_name"));
                String mime_type=cursor.getString(cursor.getColumnIndex("mime_type"));
                String title=cursor.getString(cursor.getColumnIndex("title"));
                String title_key=cursor.getString(cursor.getColumnIndex("title_key"));
                
                Log.i("YYY","id:"+id+"---size:"+size+"---modified:"+modified+"--datetaken:"+"---width:"+width+
                        "---height:"+"--mini thumb magiv:"+"---data:"+data+"--display name:"+display_name
                        +"--mini type:"+mime_type+"=----title:"+title+"---bucket_id:"+"---bucket display name:"
                        +"--description:"+"---picaser_id :"+"--date_added:"+date_added+"---title_key:"+title_key);
03-16 09:56:02.562 11611 11800 I YYY     : --:_id--:1
03-16 09:56:02.562 11611 11800 I YYY     : --:_data--:3
03-16 09:56:02.562 11611 11800 I YYY     : --:_display_name--:3
03-16 09:56:02.563 11611 11800 I YYY     : --:_size--:1
03-16 09:56:02.563 11611 11800 I YYY     : --:mime_type--:3
03-16 09:56:02.563 11611 11800 I YYY     : --:date_added--:1
03-16 09:56:02.563 11611 11800 I YYY     : --:is_drm--:1
03-16 09:56:02.563 11611 11800 I YYY     : --:date_modified--:1
03-16 09:56:02.563 11611 11800 I YYY     : --:title--:3
03-16 09:56:02.563 11611 11800 I YYY     : --:title_key--:3
03-16 09:56:02.563 11611 11800 I YYY     : --:duration--:1
03-16 09:56:02.563 11611 11800 I YYY     : --:artist_id--:1
03-16 09:56:02.563 11611 11800 I YYY     : --:composer--:0
03-16 09:56:02.563 11611 11800 I YYY     : --:album_id--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:track--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:year--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:is_ringtone--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:is_music--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:is_alarm--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:is_notification--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:is_podcast--:1
03-16 09:56:02.564 11611 11800 I YYY     : --:bookmark--:0
03-16 09:56:02.564 11611 11800 I YYY     : --:album_artist--:3
03-16 09:56:02.565 11611 11800 I YYY     : --:artist_id:1--:1
03-16 09:56:02.565 11611 11800 I YYY     : --:artist_key--:3
03-16 09:56:02.565 11611 11800 I YYY     : --:artist--:3
03-16 09:56:02.565 11611 11800 I YYY     : --:album_id:1--:1
03-16 09:56:02.565 11611 11800 I YYY     : --:album_key--:3
03-16 09:56:02.565 11611 11800 I YYY     : --:album--:3
03-16 10:07:53.209 12442 12505 I YYY     : id:635809---size:4073214---modified:1552654101--datetaken:---width:270---height:--mini thumb magiv:---data:/storage/emulated/0/netease/cloudmusic/Music/倉木麻衣 - Time after time - 花舞う街で -.mp3--display name:倉木麻衣 - Time after time - 花舞う街で -.mp3--mini type:audio/mpeg=----title:Time after time - 花舞う街で ----bucket_id:---bucket display name:--description:---picaser_id :--date_added:1552654101---title_key:θÀ°¨²Î°ÊθÀ°ghö
03-16 10:07:53.209 12442 12505 I YYY     : l2ö,
03-16 10:07:53.209 12442 12505 I YYY     : --:_data--:3

猜你喜欢

转载自blog.csdn.net/hnlgzb/article/details/88593211