Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.coderefer.androidsplashscreenexample;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/**
* Created by vamsikrishna on 12-Feb-15.
*/
public class SplashScreen extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timerThread = new Thread() {
public void run() {
try {
sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
Intent intent = new Intent(SplashScreen.this, MainActivity.class);
startActivity(intent);
}
}
};
timerThread.start();
}
@Override
protected void onPause() { // TODO Auto-generated method stub
super.onPause();
finish();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment