Try this..
I think you haven't initilize the player so that null pointer coming
You nee to check player is null or not with this if(player != null){ }
Elample is below
public void playSound(int arg)
{
if (arg == 1)
{
player = MediaPlayer.create(this, R.raw.atur);
}
if(player != null){
player.setLooping(false);
player.start();
}
try
{
if(player != null){
if (player.isPlaying())
{
player.stop();
player.release();
}
}
}
catch(Exception e)
{
}
}
EDIT:
@Override
protected void onPause()
{
if(player != null){
if (player.isPlaying())
{
player.stop();
player.release();
}
}
}