-
[onCreate(Bundle)]is where you initialize your activity.
Most importantly, here you will usually call `[setContentView(int)] with a layout resource defining your UI
and using [findViewById(int)] to retrieve the widgets in that UI that you need to interact with programmatically.
-
[onPause()]is where you deal with the user pausing active interaction with the activity. Any changes made by the user should at this point be committed (usually to the[ContentProvider](https://developer.android.com/reference/android/content/ContentProvider)holding the data). In this state the activity is still visible on screen.
访问资源:
当 Android 应用程序被编译,生成一个 R 类,其中包含了所有 res/ 目录下资源的 ID。你可以使用 R 类,通过子类+资源名或者直接使用资源 ID 来访问资源。
https://www.runoob.com/android/android-resources.html
R.layout.activity_main引用自res/layout目录下的activity_main.xml文件。onCreate()是活动被加载之后众多被调用的方法之一。
各种文件说明:
https://www.runoob.com/android/android-hello-world-example.html