I am trying to build a splash screen with music in the background, but the music doesn't play.
Here is my code:
package com.example.thebasicseries;
import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
MediaPlayer logoMusic;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
logoMusic = MediaPlayer.create(MainActivity.this,R.raw.techno );
Thread logoTimer = new Thread(){
public void run(){
try{
sleep(5000);
Intent menuIntent = new Intent("com.example.thebasicseries.MENU");
startActivity(menuIntent);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
logoMusic.release();
}
There isn't any error message showing before or after running the app.