I am making an app for playing songs with a seek bar. If I play from the raw folder it works but if I play a song from the sdcard it shows a null pointer exception.
private MediaPlayer mediaPlayer;
mediaPlayer = MediaPlayer.create(this, R.raw.t1); // it works
// switch to sdcard
mediaPlayer.setDataSource("/sdcard/t1.mp3"); // null pointer exception.
I do not know what is the problem. Please help me.