onCreate not called

This is not related to this certain issue, but also this can happen when activity is not declared in manifest file)


It's possible that onCreate doesn't get called, if the activity has never been destroyed, if for some reason an activity hangs around, next time its instantiated it is not recreated but resumed instead...

At least that's what im Dealing with right now in my code... Life cycle of Activities seem a good logical explanation.. However 99% of time I do rely on onCreate being called when startingActivity and it doesn't fail me....

Edit: And of course its because I wasn't calling finish() when exiting the activity. Doh.


What happened to me was I was overriding the wrong onCreate method. I was overriding public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) when I really needed to override protected void onCreate(@Nullable Bundle savedInstanceState). Maybe this might help someone!