以下のコードでは、getcontentresolver()
はnullですが、onCreate()
of Serviceでは機能しますが、serviceの関数では機能しません。なんで?plzは私を助けます..ありがとう
final Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
final String[] cursor_cols = { MediaStore.Audio.Media._ID,
MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DATA };
final String where = MediaStore.Audio.Media.IS_MUSIC + "=1";
cursor = getContentResolver()
.query(uri, cursor_cols, where, null, null);