I am using the following code successfully on Lollipop. But it is not working on Marshmellow. [code]for (int i = 0; i < all_track_size; i++) { SongDetailModel model = new SongDetailModel(); String path = SharedPreferenceUtil.getString("all_track_path" + i, ""); model.setSong_path(path); array_all_track.add(model); } if (array_all_track.get(pos).getSong_path().endsWith(".mp3") || array_all_track.get(pos).getSong_path().endsWith(".flac") || array_all_track.get(pos).getSong_path().endsWith(".wav")) { filePath = array_all_track.get(pos).getSong_path(); Log.d(TAG, " : SELECTED SONG : " + filePath); }[/code]