> 
> **Possible Duplicate:**  
> 
> [How to disable orientation change in Android?](https://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android) 
> 
> 
> 

I want to disable orientation change after opening the canvas in any orientation(portrait or landscape) , but I am having problem when open the canvas in the landscape mode and change the device orientation, the orientation is not disabled. 

here is the code .

```
public void onConfigurationChanged(Configuration newConfig) {

  super.onConfigurationChanged(newConfig);
  this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);

}

```