package com.example.activitylifecycle;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
((TextView)findViewById(R.id.textViewState)).setText("onCreate()\n");
}
@Override
protected void onStart() {
super.onStart();
((TextView) findViewById(R.id.textViewState)).append("onStart()\n");
}
@Override
protected void onResume() {
super.onResume();
((TextView) findViewById(R.id.textViewState)).append("onResume()\n");
}
@Override
public void onPause() {
super.onPause();
((TextView) findViewById(R.id.textViewState)).append("onPause()\n");
if (isFinishing()) {
((TextView) findViewById(R.id.textViewState)).append(" ... finishing");
}
}
@Override
protected void onStop() {
super.onStop();
((TextView) findViewById(R.id.textViewState)).append("onStop()\n");
}
@Override
protected void onRestart() {
super.onRestart();
((TextView) findViewById(R.id.textViewState)).append("onRestart()\n");
}
@Override
protected void onDestroy() {
super.onDestroy();
((TextView) findViewById(R.id.textViewState)).append("onDestroy()\n");
}
}
Search thousands of free JavaScript snippets that you can quickly copy and paste into your web pages. Get free JavaScript tutorials, references, code, menus, calendars, popup windows, games, and much more.
【Android Studio】 Activity Lifecycle
Subscribe to:
Post Comments (Atom)
Top 3 UX Design Articles of 2024 to Remember
Based on most subscriptions ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ...
-
code.gs // 1. Enter sheet name where data is to be written below var SHEET_NAME = "Sheet1" ; // 2. Run > setup // // 3....
No comments:
Post a Comment