According to the docs
A fragment transaction can only be created/committed prior to an activity saving its state. If you try to commit a transaction after Activity.onSaveInstanceState() (and prior to a following Activity.onStart or Activity.onResume(), you will get an error.
I can understand that the first part that a fragment transaction can't committed after Activity.onSaveInstanceState(), because the state after the commit can be lost if the activity needs to be restored.
But I don't understant why we can't commit a fragment transaction prior to a Activity.onStart or Activity.onResume()? Oncreate() is also prior to Activity.onStart or Activity.onResume().Does it mean that we can't even commit it in oncreate()?