title: How to implement a 'calibratable' orientation listener in android?
body: <p>Please look at the code from <a href="http://code.google.com/p/chainball/source/browse/trunk/src/com/tomten/android/chainball/OrientationManager.java?spec=svn18&amp;r=18" rel="nofollow">here</a>.</p>
  
  <p>To summarize the code in the above link, the code declares an interface ‘OrientationListener’ and ‘a class ‘OrientationManager’.  ‘OrientationManager’ listens to ‘SensorEvent’(s) and calls one of the foure decalred methods in ‘OrientationListenor’, ‘onTopUp()’, ‘onRightUp()’, ‘onBottomUp()’,  and ‘onLeftUp()’, if the device’s top, right, bottom, or left  side is facing up.</p>
  
  <p>This works great if you assume that the users only use their devices such that the xy coordinates of the device are parallel to the ground.  The reality is, users usually use their device at angel will sitting down, or laying down while holding their phone upside down.</p>
  
  <p>How can I modify this code to allow users to ‘calibrate’ their phone?</p>
  
  <p>Help is very appreciated, this is my second day looking into this with no results.</p>