There are many times when you don’t want the screen on your android phone to rotate, like when you are in bed and you are holding phone in such a way to read some thing in vertical mode but it rotates the screen as the sensor sensed that the phone is in landscape mode.
Follow the procedure below to turn off auto rotation of screen on any android phone
In my case, I am using Nexus One running Froyo 2.2
Note: Procedure might be slightly different for other phones running some other version of android.
1. On your android phone go to settings
Under Settings, tap Display
Now uncheck the settings which says auto rotate screen.
You can also install a free app named AutoRotate Switch to toggle auto screen rotate just on a single tap, You can easily find the app on android market as shown in the image below.