1

If you simply put a log statement in onCreate, you will see that it android launches onCreate twice

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_title);

    Log.d("myname", "test")

}

Usually, this doesn't bother me, but currently I am creating a splash screen that lingers for a few seconds and launches another activity. If it's the first launch - an intro activity is launched, otherwise another activity is launched. The problem arises when I save/load sharedPreferences. Since this double launch thing is happening, the app first launches intro activity, then the other one. How can I solve this problem? And is it even solvable?

Jagar
  • 777
  • 9
  • 24
  • It will always open the `launch` activity first (as you chose it in `Manifest.xml`), so your way to implement the splash screen is not the recommended one, you can follow this way: https://stackoverflow.com/a/15832037/12053756 – Jagar Nov 01 '21 at 17:52

0 Answers0