public void onDestroy() {
   super.onDestroy();
   cv.closeCamera();
   ar.close();
   // cl.close();
   // cv.closeCamera();
 }
  public void onCreate(Bundle savedInstanceState) {
    try {
      super.onCreate(savedInstanceState);

      ctx = this.getApplicationContext();
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
      requestWindowFeature(Window.FEATURE_NO_TITLE);

      getWindow()
          .setFlags(
              WindowManager.LayoutParams.FLAG_FULLSCREEN,
              WindowManager.LayoutParams.FLAG_FULLSCREEN);

      ar = new ARLayout(getApplicationContext());

      cv = new CustomCameraView(this.getApplicationContext());
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      // cl = new CompassListener(this.getApplicationContext());
      WindowManager w = getWindowManager();
      Display d = w.getDefaultDisplay();
      int width = d.getWidth();
      int height = d.getHeight();
      ar.screenHeight = height;
      ar.screenWidth = width;
      FrameLayout rl = new FrameLayout(getApplicationContext());
      rl.addView(cv, width, height);
      ar.debug = true;
      rl.addView(ar, width, height);
      setContentView(rl);
      LocationManager locMan = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
      locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 1, gpsListener);
      // Log.e("Where","Orientation:"+i);
      // rl.bringChildToFront(cl);
      addLoadingLayouts();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 private void addLoadingLayouts() {
   FourSqareVenue fs = new FourSqareVenue(this.getApplicationContext());
   fs.azimuth = 0;
   fs.inclination = 0;
   fs.name = "Loading";
   ar.addARView(fs);
   fs = new FourSqareVenue(this.getApplicationContext());
   fs.azimuth = 45;
   fs.inclination = 0;
   fs.name = "Loading";
   ar.addARView(fs);
   fs = new FourSqareVenue(this.getApplicationContext());
   fs.azimuth = 90;
   fs.inclination = 0;
   fs.name = "Loading";
   ar.addARView(fs);
   fs = new FourSqareVenue(this.getApplicationContext());
   fs.azimuth = 135;
   fs.inclination = 0;
   fs.name = "Loading";
   ar.addARView(fs);
   fs = new FourSqareVenue(this.getApplicationContext());
   fs.azimuth = 180;
   fs.inclination = 0;
   fs.name = "Loading";
   ar.addARView(fs);
   fs = new FourSqareVenue(this.getApplicationContext());
   fs.azimuth = 210;
   fs.inclination = 0;
   fs.name = "Loading";
   ar.addARView(fs);
   fs = new FourSqareVenue(this.getApplicationContext());
   fs.azimuth = 270;
   fs.inclination = 0;
   fs.name = "Loading";
   ar.addARView(fs);
   ar.postInvalidate();
 }