I have a mp3 file in my android mobile, lets it's a xyz.mp3 somewhere in my sdcard. How to play it through my application?
Simply you can use MediaPlayer and play the audio file. Check out this nice example for playing Audio:
MediaPlayer
public void audioPlayer(String path, String fileName){ //set up MediaPlayer MediaPlayer mp = new MediaPlayer(); try { mp.setDataSource(path + File.separator + fileName); mp.prepare(); mp.start(); } catch (Exception e) { e.printStackTrace(); } }
2.1m questions
2.1m answers
60 comments
57.0k users