标签:
package com.example.screenorientationchange; import android.support.v7.app.ActionBarActivity; import android.content.res.Configuration; import android.os.Bundle; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); System.out.println("-----------onCreate-----------------"); } @Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); System.out.println("-----------onStart-----------------"); } @Override protected void onRestart() { // TODO Auto-generated method stub super.onRestart(); System.out.println("-----------onRestart-----------------"); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); System.out.println("-----------onResume-----------------"); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); System.out.println("-----------onPause-----------------"); } @Override protected void onStop() { // TODO Auto-generated method stub super.onStop(); System.out.println("-----------onStop-----------------"); } @Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); System.out.println("-----------onDestroy-----------------"); } @Override public void onConfigurationChanged(Configuration newConfig) { // TODO Auto-generated method stub super.onConfigurationChanged(newConfig); System.out .println("-----------onConfigurationChanged-----------------"); } @Override protected void onSaveInstanceState(Bundle outState) { // TODO Auto-generated method stub super.onSaveInstanceState(outState); System.out.println("-----------onSaveInstanceState-----------------"); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onRestoreInstanceState(savedInstanceState); System.out .println("-----------onRestoreInstanceState-----------------"); } }
<activity android:name=".MainActivity" <span style="background-color: rgb(255, 255, 153);">android:configChanges="orientation"</span> android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
<activity android:name=".MainActivity" android:configChanges="orientation|screenSize" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
标签:
原文地址:http://blog.csdn.net/u010456903/article/details/45620553