lesson 3 The life cycle of windows

Activity is a window, representing an interface that can interact with the user.

An Android can have multiple windows, one of which is the window at startup.

The life cycle of the window: onCreate() This is the first callback, onStart()
is called when the activity is first created This callback is called when the activity is visible to the user onResume() This callback is when the application starts interacting with the user When onPause() is called the suspended activity cannot accept user input and cannot execute any code. When the current activity is about to be suspended and the last activity is about to be resumed, onStop() is called. onDestroy() is called when the activity is no longer visible. onRestart () is called before the activity is destroyed by the system . In the project registry: AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.helloworld"    android:versionCode="1"    android: versionName="1.0" >    <uses-sdk       android:minSdkVersion="8"       android:targetSdkVersion="22"


















       android:icon="@drawable/ic_launcher"
       android:label="@string/app_name"
       android:theme="@style/AppTheme" >

       <activity
          android:name=".MainActivity"
          android:label="@string/title_activity_main" >

          <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER"/>
          </intent-filter>

       </activity>

   </application>
</manifest>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326092167&siteId=291194637