-1
에 표시되지 않습니다.이 코드는 4.3 및 4.2에서 작동하지만 4.4.4 Motorola Moto G 기기의 노래를 가져 오지 않습니다.Android : 노래가 4.4.4
여기 내 코드입니다.
final String MEDIA_PATH = Environment.getExternalStorageDirectory() .getPath() + "/"; private ArrayList> 노래 목록 = 새 ArrayList>(); 공공 무효 BindAllSongs는() {
/*가 만드는 사용자 정의 그릴 수 */
String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
final String[] projection = new String[] {
MediaStore.Audio.Media.DISPLAY_NAME,
MediaStore.Audio.Media.ARTIST,
MediaStore.Audio.Media.DATA,
MediaStore.Audio.Media.DURATION};
final String sortOrder = MediaStore.Audio.AudioColumns.TITLE
+ " COLLATE LOCALIZED ASC";
try {
// the uri of the table that we want to query
Uri uri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
// query the db
cursor = context.getContentResolver().query(uri,
projection, selection, null, sortOrder);
if (cursor != null) {
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
String songTitle = cursor.getString(0);
String songArtist = cursor.getString(1);
String songData = cursor.getString(2);
String duration = cursor.getString(3);
HashMap<String, String> songMap = new HashMap<String, String>();
songMap.put("songTitle", songTitle);
songMap.put("songDuration", duration);
songMap.put("songAuthor", songArtist);
songMap.put("songPath", songData);
songsList.add(songMap);
cursor.moveToNext();
}
}
} catch (Exception ex) {
} finally {
if(cursor == null)
{
AlertDialog("No Song Found from your Device");
}
else if (cursor !=null)
{
AlertDialog(String.valueOf(cursor.getCount()) + " Song Found");
}
if (cursor != null) {
cursor.close();
}
}*
이 코드는이 문제를 해결할 수 모토로라 G 4.4.4.How에서 어떤 노래를 받고되지 않는 이유는 무엇입니까?