i have a splash screen that has some code that i only want called once so after showing the splash screen it goes to my main game, and i don’t want it going back to the splash screen again until the game is launched again. but when i hit back on my main screen, it goes back to the splash screen. how do i make the game close when the back button is pressed from the main screen instead of going back to the splash screen?
here is what i have right now on my main game, but it still goes back to the splash…
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
Toast.makeText(getApplicationContext(),"back was pressed",Toast.LENGTH_LONG).show();
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
Call
finish()in the splash activity right after you dostartActivity()🙂