Kay Ana Kay Ana - 10 months ago 68
Java Question

Android Splash Screen Delay Fail

I have a splash screen (I was required to use it) that is supposed to show for 3 second prior to the start of my game, unfortunately the game screen will not progress once the splash has started. I thought my code was implemented correctly, but I appear to have erred somewhere. Any help is appreciated.

public class SplashScreen extends AppCompatActivity{

// Splash Screen Timer
private static int SPLASH_TIME_OUT = 3000;

//@Override
public void OnCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);

new Handler().postDelayed (new Runnable() {
@Override
public void run() {
Intent i = new Intent (SplashScreen.this, Snake.class);
startActivity(i);

finish ();
}
}, SPLASH_TIME_OUT);
}
}


I know many are opposed to adding splash screens due to the fact is makes many users feel like there is a delay to the program, but again, this was not my decision, thus why I wanted to hard code is to a mere 3 seconds.

Answer Source

It's because the misspelling use onCreate instead of OnCreate. The way you are using onCreate method is never executed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download