title: After device rotation, Painting position changes automatically in the custom view in android
body: <p>I have made a custom view for drawing on canvas. I am able to draw painting in the canvas but it's position changes after rotating the device. I can not afford to fix device orientation.</p>
  
  <p></p>
  
  <hr>
  
  <p><strong><em>In portrait mode</em></strong>
  <br/>
  <a href="https://i.stack.imgur.com/SyE0u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SyE0u.png" alt="In portrait mode"></a>
  <br/>
  <br/>
  <br/></p>
  
  <hr>
  
  <p><strong><em>In landscape mode</em></strong>
  <br/>
  <a href="https://i.stack.imgur.com/l8UIz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l8UIz.png" alt="In landscape mode"></a>
  <br/></p>