Why when the new Android project is started in the Android Studio, there is no explicit call of OnStart() after OnCreate() in the autogenerated code, although all the tutorials say that OnCreate() is always followed by OnStart()?Also, I looked up in the base classes like AppCompatActivity and in the implementation of OnCreate(), there is no (explicit or implicit) callback of OnStart() either. To be clear, everything works fine, I do not have any errors or problems, but there seems to be a contradiction between what I see(no OnStart() after OnCreate() ) and what the tutorials say. Could anyone clarify this?
Official Android reference site
package mypack.helloandroid;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MyActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_layout);
}
}
LifeCycle callback methods are called for an Activity by
ActivityManager
from the System (Framework) . So you won't see any direct call of these methods inside the Activity code.These lifecycle methods are called when required. like
onCreate
will be called when the Activity instance is created newly by the framework.But
onStart
will be called when the Activity is Visible to the User.