detail code as below,i want to implement a 10 second music playing ,after the music stop automatic stop,then to another activity,current issue is when the home key is pressed during the splash screen going on,an error occur and the another activity can still enter in(it's not reasonable...) anyone can give me some help?

public class ActivitySplash extends Activity {
 private static MediaPlayer playSong;

```
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.splash);

    fontsCustom();

    playSong = MediaPlayer.create(ActivitySplash.this,
            R.raw.fsir200splashmusic);
    playSong.start();

    Thread timer = new Thread() {
        public void run() {
            try {
                while (playSong.isPlaying()) {
                    sleep(500);
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
                Intent beginActivityInt = new Intent(
                        "android.intent.action.ACTIVITYMAIN");
                startActivity(beginActivityInt);
            }

        }
    };
    timer.start();
}

public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {

        return true; // always eat it!
    } else if (keyCode == KeyEvent.KEYCODE_BACK) {
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_HOME)
        return true;
    else
        return super.onKeyDown(keyCode, event);
}

public void fontsCustom() {
    FontCustom fonts = new FontCustom(ActivitySplash.this);
    LinearLayout layout = (LinearLayout) findViewById(R.id.id_layout_splash);
    fonts.setupLayoutTypefaces(layout);
}

@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    playSong.release();
    finish();
}

```