Android 未调用OnConfiguration Changed
为什么在emulator中切换方向(ctrl+F11)时未调用OnConfiguration Changed override方法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
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不支持