Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 未调用OnConfiguration Changed_Android - Fatal编程技术网

Android 未调用OnConfiguration Changed

Android 未调用OnConfiguration Changed,android,Android,为什么在emulator中切换方向(ctrl+F11)时未调用OnConfiguration Changed override方法 public class HelloSample extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCr

为什么在emulator中切换方向(ctrl+F11)时未调用OnConfiguration Changed override方法

public class HelloSample extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);                
        setContentView(R.layout.main);
        System.out.println("Change in Orientation");
    }

}
在manifest.xml中

<application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".HelloSample"
                  android:label="@string/app_name"
                  android:configChanges="orientation|keyboardHidden"
                  >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

使用真实设备,emulator不支持