You can try something like this.
// Add permission to your menifest to Read File from your storage
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Then in your JAVA class/Activity from where you are calling to load mp3 File.
MediaPlayer mPlayer;
// Your Media Player will be called with Audio file here..
private void loadAudio(){
String fileName = "YourAudio.mp3";
String completePath = Environment.getExternalStorageDirectory() + "/" + fileName;
File file = new File(completePath);
Uri myUri1 = Uri.fromFile(file);
mPlayer = new MediaPlayer();
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mPlayer.setDataSource(getApplicationContext(), myUri1);
} catch (IllegalArgumentException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (SecurityException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IllegalStateException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
}
try {
mPlayer.prepare();
} catch (IllegalStateException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
}
mPlayer.start();
}
I hope this will help you.