Getting wrong device angle between 0 to 105 degree onSensorChanged
<p>i want to get angle between 0 to 90 degree only and i am getting wrong degree onSensorChnaged when my device is at 90 degree then i am getting 105 degree 
so please help me to get correct angle
i have test this on device samsung galaxy s duos and micromax and also get UI freezing.</p>

<pre><code>private void init() {
        oldBitmap = BitmapFactory.decodeResource(getResources(),
                R.drawable.clock1);
        w = oldBitmap.getWidth();
        h = oldBitmap.getHeight();
        mtx = new Matrix();
        degrees = Integer.parseInt(x.toString());
        mtx.postRotate(-degrees);
        oldBitmap = Bitmap.createBitmap(oldBitmap, 0, 0, w, h, mtx, true);
        img.setScaleType(ScaleType.CENTER);
        img.setImageBitmap(oldBitmap);
    }
    @Override
    protected void onResume() {
        super.onResume();
        sensorManager.registerListener(this,
                sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
                SensorManager.SENSOR_DELAY_NORMAL);
        sensorManager.registerListener(this,
                sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION),
                SensorManager.SENSOR_DELAY_NORMAL);
    }
    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
        // TODO Auto-generated method stub
    }

    @Override
    public void onSensorChanged(SensorEvent event) {
        // TODO Auto-generated method stub
        if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {                  
            //x = (int) Math.pow(event.values[0], 2);  // is for the right to left or left to right side angle
            //x = (int) Math.pow(event.values[2], 2); // this is for the bottom to top or top to bottom side angle
            x = (int) Math.pow(event.values[1], 2); // this is for both side angle

            try {
                Log.i("my x is..", "my degree is..."+x);    
                    txtanglex.setText(x.toString());            
                    init();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
</code></pre>

<p>from above code i get device angle between 0 to 105</p>

<p><img src="http://i.stack.imgur.com/XjGGI.png" alt="enter image description here"></p>
