How it works?
1. Create raw folder under res folder. Drag your mp3 file inside the raw folder.
2. Create splash.xml layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/logo">
</LinearLayout>
3. Create Splash.java program.
package www.tukartukar.com;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
public class Splash extends Activity{
public MediaPlayer myMedia;
protected void onCreate(Bundle sirsuspect) {
// TODO Auto-generated method stub
super.onCreate(sirsuspect);
setContentView(R.layout.splash);
myMedia = MediaPlayer.create(Splash.this, R.raw.bass);
myMedia.start();
Thread timer = new Thread(){
public void run(){
try{
sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent myIntent = new Intent("www.tukartukar.com.TUKAR2ACTIVITY");
startActivity(myIntent);
}
}
};
timer.start();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
myMedia.release();
finish();
}
}
4. Modify AdroidManifest.xml.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="www.tukartukar.com"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Tukar2Activity"
android:label="@string/app_name"
android:icon="@drawable/tilan" >
<intent-filter>
<action android:name="www.tukartukar.com.TUKAR2ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>