Android: How to execute url based on Tablet orientation Change
<p>How to execute url based on tablet orientation change. If i down the tablet on left side it should execute one url and if i down the tablet on right side it should execute another url. I used orientation change sensor but its not working fine.</p>

<pre><code>private OrientationEventListener MyOrientationEventListener;
int DirectionValue;
MyOrientationEventListener = new  OrientationEventListener(this,SensorManager.SENSOR_DELAY_NORMAL)
    {
        @Override
        public void onOrientationChanged(int arg0) 
        {
          DirectionValue = arg0;
          if(DirectionValue &gt; 180)
          {
              // Execute left url
          }
          else if(DirectionValue &gt; 300)
          {
             // Execute right url
          }
          else if(DirectionValue &gt; 274)
          {
                         // Execute up url
          }
          else if(DirectionValue &gt; 80)
          {
                        // Execute down url
          }
          else if(DirectionValue == -1)
          {
                        // Execute stop url 
                      }
        }
    };

    if (MyOrientationEventListener.canDetectOrientation()) 
    {
        MyOrientationEventListener.enable();
    } 
    else 
    {
        finish();
    }
</code></pre>

<p>can anyone help me?</p>
