This is the full code for the splash screen. I will keep on adding stuff to it as I explain and also learn. So it isnt the complete thing.
package com.learning.gilo; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; public class Splash extends Activity{ MediaPlayer song; protected void onCreate(Bundle b){ super.onCreate(b); setContentView(R.layout.splash); song = MediaPlayer.create(Splash.this, R.raw.door); //the song is door.mp3 song.start(); Thread mythread = new Thread(){ public void run(){ try{ sleep(2000); }catch(InterruptedException e){ e.printStackTrace(); }finally{ Intent myIntent = new Intent("com.learning.gilo.MENULIST"); startActivity(myIntent); } } }; mythread.start(); } protected void onPause(){ super.onPause(); song.release(); finish(); } }
2 responses to “Source code: The Splash screen”