i am getting the audio files information in sdcard using
cr = getContentResolver();
crsrSdcard_ringtone = cr.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null,
null, MediaStore.Audio.Media._ID);
now i want to play particular file from the list can i do it with passing it like
MediaPlayer mediaPlay = new MediaPlayer();
mediaPlay.setDataSource(this,Uri.withAppendedPath(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, "/"+id));
mediaPlay.prepare();
mediaPlay.start();
please suggest a solution to get the file being played.
i recently come to know about _data field no 1 in the cursor returned crsrSdcard_ringtone will contain real path(/sdcard/Doorbell.mp3) to the file which will be useful to play that file which we can use with setDataSource() function of MediaPlayer