package ch.maden.dm002; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; public class Splash extends Activity { MediaPlayer ourSong; // Declare ourSong to be visible in whole class. @Override protected void onCreate (Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate (savedInstanceState); setContentView (R.layout.splash); ourSong = MediaPlayer.create (Splash.this, R.raw.dm_splashsound); ourSong.start (); Thread timer = new Thread () { public void run () { try { sleep (5000); // Sleep for 5000 msec } catch (InterruptedException e) { e.printStackTrace (); // debug dump } finally { Intent openStartingPoint = new Intent ("ch.maden.dm002.STARTINGPOINT"); startActivity (openStartingPoint); } } }; timer.start (); } @Override protected void onPause () { // TODO Auto-generated method stub super.onPause (); ourSong.release (); // Stop ourSong if it exceeds 5 secs. finish (); } }