我在 SD 卡上有歌曲,我正在尝试获取该歌曲的标题:
File f = new File(filename);
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 musiccursor = managedQuery(Uri.fromFile(f),
projection, null, null, null);
musicTV.setText(musiccursor.getString(3));
但在最后一行我有NullPointerException
。感谢您的任何建议。