@@ -0,0 +1,2470 @@
+/*%0A   Programmer: Kristoffer Larson%0A   Date: February 10, 2014%0A   %0A   Description: Listens for the orientation of the phone%0A      and runs information on the UI thread. The listener%0A      won't start with an orientation with respect to he %0A      phones current position, but will calculate orientation%0A      with respect to that of the origin.%0A*/%0A//Some of these probably aren't necessary%0Aimport android.app.Activity;%0Aimport android.graphics.drawable.GradientDrawable;%0Aimport android.hardware.Sensor;%0Aimport android.hardware.SensorEvent;%0Aimport android.hardware.SensorEventListener;%0Aimport android.hardware.SensorManager;%0Aimport android.os.Bundle;%0Aimport android.util.Log;%0Aimport android.view.OrientationEventListener;%0Aimport android.widget.TextView;%0Aimport android.widget.Toast;%0A%0Aimport java.util.List;%0A%0Apublic class PhoneOrientation extends Activity  %7B%0A    // Orientation X, Y, and Z values%0A    private TextView orientXValue;%0A    private OrientationEventListener sensorListener;%0A    boolean ready = false;%0A%0A    /** Called when the activity is first created. */%0A    @Override%0A    public void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView (R.layout.main);%0A        orientXValue=(TextView) findViewById(R.id.orient_x_value);%0A        orientXValue.setText(%220.00%22);%0A%0A        sensorListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) %7B%0A            @Override%0A            public void onOrientationChanged(final int orientation) %7B%0A                MyActivity.this.runOnUiThread(new Runnable() %7B%0A                    @Override%0A                    public void run() %7B%0A                        orientXValue.setText(%22Orientation: %22 + orientation);%0A                        //Log.e(%22the x value is :%22, %22%22+orientXValue.getX()); //Log phone orientation%0A%0A                        if((orientation%3E355)%7C%7C(orientation%3C5)%7C%7C((orientation%3E85)&&(orientation%3C95)) //True when at certain orientations%0A                                %7C%7C((orientation%3E175)&&(orientation%3C185))%7C%7C((orientation%3E265)&&(orientation%3C285)))%7B%0A                            ready=true;%0A                        %7D else %7B%0A                            ready=false;%0A                        %7D%0A%0A                        if (ready)%7B%0A                            Log.e(%22yay%22,%22it works!!!%22); //Log test%0A                        %7D%0A                    %7D%0A                %7D);%0A            %7D%0A        %7D;%0A        sensorListener.enable(); //Enables Listener%0A    %7D%0A%7D%0A

Create PhoneOrientation.java