http://blog.csdn.net/zxccxzzxz/article/details/52282256
Code snippet:
private int mLastRotation = -1;
mOrientationEventListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) { @Override public void onOrientationChanged(int orientation) { if (orientation == ORIENTATION_UNKNOWN) { return; } Display display = windowManager.getDefaultDisplay(); int rotation = display.getRotation(); if (mLastRotation == DEFAULT_ROTATION){ mLastRotation = rotation; } else if (rotation != mLastRotation) { mLastRotation = rotation; // notify orientation change } } };
沒有留言:
張貼留言