Android - What is wrong with the onStart method?

I am trying to understand the life cycle of Android Activity. For this purpose, I created an Activity, where I redefined all life methods (onCreate, onStart, onRestart, onResume, onPause, onStop, onDestroy):

public class SecondActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        Log.d("ActivityTutorial", "onCreate");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d("ActivityTutorial", "onStart");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.d("ActivityTutorial", "onRestart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.d("ActivityTutorial", "onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d("ActivityTutorial", "onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d("ActivityTutorial", "onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d("ActivityTutorial", "onDestroy");
    }

}

I set breakpoints on the lines where I log in using Log.d (...). Then I tried to debug. The onCreate method is fine - it calls when the activity is created.

A strange situation begins with the onStart method. According to Android documentation : "onStart () Called when the action becomes visible to the user." But when I debug, it comes to the onStart method, but the Button that is in this Activity is not yet displayed.

enter image description here

, onResume() - onStart(). .

enter image description here

onResume, .

enter image description here

, , onStart onResume? , - , ?

+4
3

. onResume() Activity. , : "onStart() , .

: "onResume() , .

UPDATE:

, onResume , ; , . onWindowFocusChanged (boolean), (, ).

0

onResume() onStart(). . Android .

0

, onStart() - , - . , onCreate() , .

, onStop(). , .

onStart() onResume(). onResume() . , , onResune(), onStart(). , , . , , .

0

Source: https://habr.com/ru/post/1610245/


All Articles