I have implemented a splash screen, to hold/pause the screen for few seconds and then launch the next screen. I am very enthusiastic to know if there is a more basic way to write the code.
public class SplashActivity extends BaseActivity {
private final int SPLASH_TIME_OUT = 2000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Thread splashTimerThread = new Thread() {
public void run() {
try {
Thread.sleep(SPLASH_TIME_OUT);
} catch (InterruptedException interruptedException) {
interruptedException.printStackTrace();
} finally {
Intent intent = new Intent(SplashActivity.this, HomeActivity.class);
startActivity(intent);
}
}
};
splashTimerThread.start();
}
@Override
protected void onPause() {
super.onPause();
finish();
}
}