You can use accelerometer and magnetic field sensors to calculate the device rotation and then call
getWindowManager().getDefaultDisplay().getRotation();
when the rotation is at certain value. The way to calculate the rotation is at my answer How to measure the tilt of the phone in XY plane using accelerometer in Android