Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tabs);

    // Adding the zoom option
    mapView = (MapView) findViewById(R.id.MapView);
    LinearLayout zoomLayout = (LinearLayout) findViewById(R.id.zoom);
    View zoomView = mapView;

    zoomLayout.addView(
        zoomView,
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mapView.displayZoomControls(true);

    mc = mapView.getController();
    String coordinates[] = {"32.2217429", " -110.926479"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));

    mc.animateTo(p);
    mc.setZoom(10);
    mapView.invalidate();
    mapView.setSatellite(false);
    mapView.setStreetView(false);
    // bTakePicture = (Button)findViewById(R.id.bTakePicture);
    // bTakePicture.setOnClickListener(this);
  }
Exemplo n.º 2
0
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) { // click zoom key
   if (keyCode == KeyEvent.KEYCODE_S) {
     map.setSatellite(!map.isSatellite());
     return (true);
   } else if (keyCode == KeyEvent.KEYCODE_Z) {
     map.displayZoomControls(true);
     return (true);
   }
   return (super.onKeyDown(keyCode, event));
 }
Exemplo n.º 3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapV = (MapView) findViewById(R.id.mapView);

    mapV.displayZoomControls(true);
    mapV.setBuiltInZoomControls(true);
    mapV.setSaveEnabled(true);

    initlocation.setLatitude(0.1);
    initlocation.setLongitude(0.1);

    GeoP =
        new GeoPoint(
            (int) (initlocation.getLatitude() * 1E6), (int) (initlocation.getLongitude() * 1E6));

    posOverlay = new MapOverlay();
    List<Overlay> overlays = mapV.getOverlays();
    overlays.add(posOverlay);

    mControl = mapV.getController();
    mControl.animateTo(GeoP);
    mControl.setZoom(5);

    Bitmap iss = BitmapFactory.decodeResource(getResources(), R.drawable.iss);
    Bitmap logo = BitmapFactory.decodeResource(getResources(), R.drawable.logo);
    Bitmap logotext = BitmapFactory.decodeResource(getResources(), R.drawable.logotext);
    Bitmap tracker = BitmapFactory.decodeResource(getResources(), R.drawable.isstracker);
    posOverlay.SetImages(iss, logo, logotext, tracker);
    posOverlay.setLocation(initlocation);

    if (CheckNetwork(getApplicationContext())) {
      startUpdateTimer();
    } else {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setMessage(
          "No data connection found, please check you have a mobile data connection or wifi enabled.");
      builder.setNegativeButton(
          "Quit",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
              finish();
            }
          });
      AlertDialog alert = builder.create();

      alert.show();
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map);

    map = (MapView) findViewById(R.id.mapView);
    map.displayZoomControls(true);
    map.setBuiltInZoomControls(true);

    int selectedTour = getIntent().getIntExtra("tourID", -1) + 1;
    final Tour t = ParseToursXML.getTour(String.valueOf(selectedTour));
  }
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   final MapView mapView = (MapView) findViewById(R.id.mapView);
   mapView.setBuiltInZoomControls(true);
   mapView.getZoomButtonsController().setAutoDismissed(false);
   mapView.displayZoomControls(true);
   overlay = new SampleBalloonItemizedOverlay(mapView);
   mapView.getOverlays().add(overlay);
   mapView.getController().animateTo(new GeoPoint(42431320, -8642187));
   mapView.getController().setZoom(16);
   mapView.invalidate();
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Log.d("Test", "I already reach there");
   setContentView(R.layout.main);
   // launchGPSOptions();
   mapView = (MapView) findViewById(R.id.myMap);
   LinearLayout zoomLayout = (LinearLayout) findViewById(R.id.zoom);
   View zoomView = mapView.getZoomControls();
   mapView.displayZoomControls(true);
   mapView.setStreetView(true);
   mapController = mapView.getController();
   mapController.setZoom(14);
   mapView.setOnTouchListener(
       new OnTouchListener() {
         @Override
         public boolean onTouch(View arg0, MotionEvent arg1) {
           return onTouchEvent((MapView) arg0, arg1);
         }
       });
   listOfOverlays = mapView.getOverlays();
   zoomLayout.addView(
       zoomView,
       new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
   final TelephonyManager tm =
       (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
   final String tmDevice, tmSerial, androidId;
   tmDevice = "" + tm.getDeviceId();
   tmSerial = "" + tm.getSimSerialNumber();
   androidId =
       ""
           + android.provider.Settings.Secure.getString(
               getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
   UUID deviceUuid =
       new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
   uuid = deviceUuid.toString();
   logging("UUID " + uuid);
   preSetting = getSharedPreferences(PREFERENCE_NAME, MODE_PRIVATE);
   startService(new Intent(AlertService.class.getName()));
   locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
   locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 10f, this);
   locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 100, 10f, this);
   displayLocationTask = new DisplayLocationTask();
   timer = new Timer("UpdateOtherLocationTimer");
   checkLocationAndAction();
 }
Exemplo n.º 7
0
  private void updateMapView() {
    int intZoomLevel = 17;
    MapView mapView = (MapView) findViewById(0 /*R.id.map*/);
    mapController = mapView.getController();
    mapView.setSatellite(false);
    mapView.setStreetView(true);
    mapView.setTraffic(true);

    geoPoint = new GeoPoint((int) (dLat), (int) (dLng /* * 1E6*/)); // 將剛剛取得的座標置入geoPoint
    mapView.displayZoomControls(true);
    mapView.setBuiltInZoomControls(true);

    mapController.animateTo(geoPoint); // 將map的中心點移到自己所在的位置
    mapController.setZoom(intZoomLevel); // 設定地圖級距

    // 加入地圖標籤
    MyLocationOverlay mapOverlay = new MyLocationOverlay(context, mapView);
    List listOfOverlays = mapView.getOverlays();
    listOfOverlays.clear();
    listOfOverlays.add(mapOverlay);
  }
Exemplo n.º 8
0
    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String licenseKey = getLicenseKey();
        map = new MapView(this, licenseKey);
        
        this.setContentView(map);
        
        mGeoCoder = new Geocoder(this);
        
        // Get the location manager
        mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        // Define the criteria how to select the locatioin provider -> use
        // default
        Criteria criteria = new Criteria();
        String provider = mLocationManager.getBestProvider(criteria, false);
        Location location = mLocationManager.getLastKnownLocation(provider);

        session = CommCareApplication._().getCurrentSession();
        Vector<Entry> entries = session.getEntriesForCommand(session.getCommand());
        prototype = entries.elementAt(0);
        
        SessionDatum selectDatum = session.getNeededDatum();
        Detail detail = session.getDetail(selectDatum.getShortDetail());
        NodeEntityFactory factory = new NodeEntityFactory(detail, this.getEC());
        
        Vector<TreeReference> references = getEC().expandReference(selectDatum.getNodeset());
        
        entities = new Vector<Entity<TreeReference>>();
        for(TreeReference ref : references) {
            entities.add(factory.getEntity(ref));
        }

        Log.d(TAG, "Entities generated");
        
        map.displayZoomControls(true);
        mMyLocationOverlay = new MyLocationOverlay(this, map);
        mMyLocationOverlay.runOnFirstFix(new Runnable() { public void run() {
            map.getController().animateTo(mMyLocationOverlay.getMyLocation());
        }});
        
        double[] boundHints = new double[4];
        // Initialize the location fields
        if (location != null) {
            double lat = location.getLatitude();
            double lng = location.getLongitude();
            
            //lLat
            boundHints[0] = lat -1;
            //lLng
            boundHints[1] = lng -1;
            
            //uLat
            boundHints[2] = lat + 1;
            
            //rLon
            boundHints[3] = lng + 1;
            
            
        } else {
            //no location
        }
        
        Drawable defaultMarker = this.getResources().getDrawable(R.drawable.marker);
        mEntityOverlay = new EntityOverlay(this, defaultMarker, map) {

            @Override
            protected void selected(TreeReference ref) {
                Intent i = new Intent(EntityMapActivity.this.getIntent());
                SerializationUtil.serializeToIntent(i, EntityDetailActivity.CONTEXT_REFERENCE, ref);
                
                setResult(RESULT_OK, i);

                EntityMapActivity.this.finish();                
            }
        };
        Log.d(TAG, "Loading addresses...");
        
        int legit = 0;
        int bogus = 0;
        
        EntityOverlayItemFactory overlayFactory = new EntityOverlayItemFactory(detail, defaultMarker);
        
        SqlStorage<GeocodeCacheModel> geoCache = CommCareApplication._().getUserStorage(GeocodeCacheModel.STORAGE_KEY, GeocodeCacheModel.class);
        
        for(Entity<TreeReference> e : entities) {
            for(int i = 0 ; i < detail.getHeaderForms().length; ++i ){
                if("address".equals(detail.getTemplateForms()[i])) {
                    String val = e.getFieldString(i).trim();
                    if(val != null && val != "") {
                        GeoPoint gp = null;
                        try {
                            GeoPointData data = new GeoPointData().cast(new UncastData(val));
                            if(data != null) {
                                int lat = (int) (data.getValue()[0] * 1E6);
                                int lng = (int) (data.getValue()[1] * 1E6);
                                gp = new GeoPoint(lat, lng);
                            }
                        } catch(Exception ex) {
                            //We might not have a geopoint at all. Don't even trip
                        }
                        
                        boolean cached = false;
                        try {
                            GeocodeCacheModel record = geoCache.getRecordForValue(GeocodeCacheModel.META_LOCATION, val);
                            cached = true;
                            if(record.dataExists()){
                                gp = record.getGeoPoint();
                            }
                        } catch(NoSuchElementException nsee) {
                            //no record!
                        }
                        
                        //If we don't have a geopoint, let's try to find our address
                        if(!cached && boundHints != null) {
                            try {
                                List<Address> addresses = mGeoCoder.getFromLocationName(val, 3, boundHints[0], boundHints[1], boundHints[2], boundHints[3]);
                                for(Address a : addresses) {
                                    if(a.hasLatitude() && a.hasLongitude()) {
                                        int lat = (int) (a.getLatitude() * 1E6);
                                        int lng = (int) (a.getLongitude() * 1E6);
                                        gp = new GeoPoint(lat, lng);
                                        
                                        try {
                                            geoCache.write(new GeocodeCacheModel(val, lat, lng));
                                        } catch (StorageFullException e1) {
                                            //this is the worst exception ever.
                                        }
                                        legit++;
                                        break;
                                    }
                                }
                                
                                //We didn't find an address, make a miss record
                                if(gp == null) {
                                    try {
                                        geoCache.write(GeocodeCacheModel.NoHitRecord(val));
                                    } catch (StorageFullException e1) {
                                        //this is the worst exception ever.
                                    }
                                }
                            } catch (IOException e1) {
                                e1.printStackTrace();
                                //Yo. What? I guess bad connection?
                            }
                        }
                        
                        //Ok, so now we have an address or not. If we _do_ have one, let's have some fun
                        
                        if(gp != null) {
                            OverlayItem overlayItem = overlayFactory.generateOverlay(gp, e);
                            mEntityOverlay.addOverlay(overlayItem, e.getElement());
                        }
                        else { 
                            bogus++;
                        }
                    }
                }
            }
        }
        
        Log.d(TAG, "Loaded. " + legit +" addresses discovered, " + bogus + " could not be located");

        if(legit != 0 && mEntityOverlay.getCenter() != null) {
            map.getController().animateTo(mEntityOverlay.getCenter());
        } else if(location != null) {
            int lat = (int) (location.getLatitude() * 1E6);
            int lng = (int) (location.getLongitude() * 1E6);
            GeoPoint point = new GeoPoint(lat, lng);
            map.getController().animateTo(point);
        }
        
        map.getOverlays().add(mMyLocationOverlay);
        //The overlay crashes out if you try to draw it and it's empty,
        //so only add it if we found something.
        if(mEntityOverlay.size() > 0) {
            map.getOverlays().add(mEntityOverlay);
        }
        map.getController().setZoom(18);
        map.setClickable(true);
        map.setEnabled(true);
        Log.d(TAG, "Done loading");
    }
Exemplo n.º 9
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_code);
    MapView mapView = (MapView) findViewById(R.id.mapView);

    LinearLayout zoomLayout = (LinearLayout) findViewById(R.id.zoom);
    @SuppressWarnings("deprecation")
    View zoomView = mapView.getZoomControls();

    zoomLayout.addView(
        zoomView,
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mapView.displayZoomControls(true);

    mc = mapView.getController();
    String coordinates[] = {"26.0607739", "50.5553531"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));

    mc.animateTo(p);
    mc.setZoom(12);
    mapView.invalidate();

    List<Overlay> mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.bin);
    MapItemizedOverly itemizedoverlay = new MapItemizedOverly(drawable, this);

    int lat2 = 26127948;
    int lng4 = 50588877;

    p = new GeoPoint((int) (lat2 / 1E6), (int) (lng4 / 1E6));

    GeoPoint JwdCentre = new GeoPoint(lat2, lng4);
    OverlayItem overlayItemJwdCentre =
        new OverlayItem(
            JwdCentre, "Jawad , The Centre", "Available Types: Plastic,Paper,Metal,Glass");

    int lat1 = 26164950;
    int lng1 = 50544669;

    z = new GeoPoint((int) (lat1 / 1E6), (int) (lng1 / 1E6));

    GeoPoint BP = new GeoPoint(lat1, lng1);
    OverlayItem overlayItemBP =
        new OverlayItem(BP, "Bahrain Polytechnic", "Available Types: Plastic,Paper,Metal");

    int lat0 = 26277675;
    int lng0 = 50662026;

    t = new GeoPoint((int) (lat0 / 1E6), (int) (lng0 / 1E6));

    GeoPoint OsraAmwj = new GeoPoint(lat0, lng0);
    OverlayItem overlayitemOsraAmwj =
        new OverlayItem(
            OsraAmwj, "Al Osra Market ,Amwaj", "Available Types: Plastic,Paper,Metal,Glass");

    int lat3 = 26216668;
    int lng3 = 50479486;

    Njb = new GeoPoint((int) (lat3 / 1E6), (int) (lng3 / 1E6));

    GeoPoint Najibi = new GeoPoint(lat3, lng3);
    OverlayItem overlayitemNajinbi =
        new OverlayItem(Najibi, "Najibi Mall", "Available Types: Plastic,Paper,Metal,Glass");

    int lat5 = 26221076;
    int lng5 = 50489421;

    Fd = new GeoPoint((int) (lat5 / 1E6), (int) (lng5 / 1E6));

    GeoPoint FdG = new GeoPoint(lat5, lng5);
    OverlayItem overlayitemFdG =
        new OverlayItem(FdG, "Jawad Food Garden", "Available Types: Plastic,Paper,Metal,Glass");

    int lat6 = 26221076;
    int lng6 = 50489421;

    Mi = new GeoPoint((int) (lat6 / 1E6), (int) (lng6 / 1E6));

    GeoPoint MidH = new GeoPoint(lat6, lng6);
    OverlayItem overlayitemMid =
        new OverlayItem(
            MidH, "Midway Market , Hamalah", "Available Types: Plastic,Paper,Metal,Glass");

    int lat7 = 26229356;
    int lng7 = 50542167;

    BEC = new GeoPoint((int) (lat7 / 1E6), (int) (lng7 / 1E6));

    GeoPoint BECI = new GeoPoint(lat7, lng7);
    OverlayItem overlayitemBEC =
        new OverlayItem(BECI, "Bahrain Exhibition Centre", "Available Types: Aluminum,Paper,Glass");

    int lat8 = 26195681;
    int lng8 = 50478112;

    SarC = new GeoPoint((int) (lat8 / 1E6), (int) (lng8 / 1E6));

    GeoPoint SC = new GeoPoint(lat8, lng8);
    OverlayItem overlayitemSC =
        new OverlayItem(SC, "Sar Cinema", "Available Types: Aluminum,Paper,Glass,Plastic");

    int lat9 = 26130232;
    int lng9 = 50656794;

    DarI = new GeoPoint((int) (lat9 / 1E6), (int) (lng9 / 1E6));

    GeoPoint Dar = new GeoPoint(lat9, lng9);
    OverlayItem overlayitemDar =
        new OverlayItem(Dar, "Al Dar Island", "Available Types: Aluminum,Paper,Glass,Plastic");

    int lat10 = 26229150;
    int lng10 = 50537321;

    GeantG = new GeoPoint((int) (lat10 / 1E6), (int) (lng10 / 1E6));

    GeoPoint Geant = new GeoPoint(lat10, lng10);
    OverlayItem overlayitemGeant = new OverlayItem(Geant, "Geant", "Available Types: Plastic Bags");

    int lat11 = 26097468;
    int lng11 = 50564435;

    Rv = new GeoPoint((int) (lat11 / 1E6), (int) (lng11 / 1E6));

    GeoPoint RiffaViews = new GeoPoint(lat11, lng11);
    OverlayItem overlayitemRv =
        new OverlayItem(RiffaViews, "Riffa Views", "Available Types: Aluminum,Paper,Glass,Plastic");

    int lat12 = 26205629;
    int lng12 = 50499065;

    Stc = new GeoPoint((int) (lat12 / 1E6), (int) (lng12 / 1E6));

    GeoPoint StChris = new GeoPoint(lat12, lng12);
    OverlayItem overlayitemStc =
        new OverlayItem(
            StChris,
            "St. Christophers Junior School",
            "Available Types: Aluminum,Paper,Glass,Plastic");

    int lat13 = 26212435;
    int lng13 = 50592926;

    NY = new GeoPoint((int) (lat13 / 1E6), (int) (lng13 / 1E6));

    GeoPoint NYIT = new GeoPoint(lat13, lng13);
    OverlayItem overlayitemNY =
        new OverlayItem(
            NYIT,
            "New York Institute Of Technology",
            "Available Types: Aluminum,Paper,Glass,Plastic");

    int lat14 = 26179689;
    int lng14 = 50536672;

    AK = new GeoPoint((int) (lat14 / 1E6), (int) (lng14 / 1E6));

    GeoPoint Kano = new GeoPoint(lat14, lng14);
    OverlayItem overlayitemKano =
        new OverlayItem(
            Kano, "Abdulrahman Kanoo School", "Available Types: Aluminum,Paper,Glass,Plastic");

    itemizedoverlay.addOverlay(overlayitemKano);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemNY);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemStc);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemRv);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemGeant);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemDar);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemSC);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayItemJwdCentre);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayItemBP);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemOsraAmwj);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemNajinbi);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemFdG);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemMid);
    mapOverlays.add(itemizedoverlay);

    itemizedoverlay.addOverlay(overlayitemBEC);
    mapOverlays.add(itemizedoverlay);

    MapController mapController = mapView.getController();

    mapController.animateTo(BP);
    mapController.setZoom(12);

    mapController.animateTo(OsraAmwj);
    mapController.setZoom(12);

    mapController.animateTo(JwdCentre);
    mapController.setZoom(12);

    mapController.animateTo(Najibi);
    mapController.setZoom(12);

    mapController.animateTo(FdG);
    mapController.setZoom(12);

    mapController.animateTo(MidH);
    mapController.setZoom(12);

    mapController.animateTo(BECI);
    mapController.setZoom(12);

    mapController.animateTo(SC);
    mapController.setZoom(12);

    mapController.animateTo(Dar);
    mapController.setZoom(12);

    mapController.animateTo(Geant);
    mapController.setZoom(12);

    mapController.animateTo(RiffaViews);
    mapController.setZoom(12);

    mapController.animateTo(StChris);
    mapController.setZoom(12);

    mapController.animateTo(NYIT);
    mapController.setZoom(12);

    mapController.animateTo(Kano);
    mapController.setZoom(12);
  }
Exemplo n.º 10
0
  /**
   * Called when the activity is first created. Setups google mapView, the map overlays and the
   * listeners
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(this.getClass().getName(), "creating activity");
    super.onCreate(savedInstanceState);

    // get extras
    Bundle extras = getIntent().getExtras();
    String id = extras.getString("missionID");
    mission = Mission.get(id);
    mission.setStatus(Globals.STATUS_RUNNING);

    setContentView(R.layout.main);

    // Setup Google MapView
    myMapView = (MapView) findViewById(R.id.mapview);
    myMapView.setBuiltInZoomControls(false);
    myMapView.displayZoomControls(false);

    String mapKind = mission.xmlMissionNode.attributeValue("mapkind");
    if (mapKind == null || mapKind.equals("map")) myMapView.setSatellite(false);
    else myMapView.setSatellite(true);

    myMapCtrl = myMapView.getController();

    myMapCtrl.setZoom(18);
    String zoomLevel = mission.xmlMissionNode.attributeValue("zoomlevel");
    if (zoomLevel != null) {
      int zoomLevelInt = Integer.parseInt(zoomLevel);
      if (zoomLevelInt > 0 && zoomLevelInt < 24) myMapCtrl.setZoom(zoomLevelInt);
    }

    // Setup Zoom Controls:
    Button zoomIn = (Button) findViewById(R.id.zoom_in);
    zoomIn.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            myMapCtrl.zoomIn();
          }
        });

    Button zoomOut = (Button) findViewById(R.id.zoom_out);
    zoomOut.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            myMapCtrl.zoomOut();
          }
        });

    // Initialize location stuff:
    locationListener =
        new GeoQuestLocationListener(this) {
          public void onRelevantLocationChanged(Location location) {
            super.onRelevantLocationChanged(location);
            GeoPoint point = location2GP(location);
            myMapCtrl.animateTo(point);

            // calculate distance to hotspots
            for (Iterator<HotspotOld> i = hotspots.listIterator(); i.hasNext(); ) {
              HotspotOld hotspot = i.next(); // TODO: throws a
              // ConcurrentModificationException
              // sometimes (hm)
              hotspot.inRange(location);
            }
          }
        };

    try {
      long timeStepMockMode = Long.parseLong(getText(R.string.map_mockGPSTimeInterval).toString());
      locationSource =
          new LocationSource(getApplicationContext(), locationListener, handler, timeStepMockMode);
      locationSource.setMode(LocationSource.REAL_MODE);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // startMissionsList
    startMissionPanel = (LinearLayout) findViewById(R.id.startMissionPanel);

    // Players Location Overlay
    myLocationOverlay = new MyLocationOverlay(this, myMapView);
    myLocationOverlay.enableCompass(); // doesn't work in the emulator?
    myLocationOverlay.enableMyLocation();
    myMapView.getOverlays().add(myLocationOverlay);

    GeoQuestApp.getInstance().setGoogleMap(myMapView);

    // Show loading screen to Parse the Game XML File
    // indirectly calls onCreateDialog() and initializes hotspots
    showDialog(READXML_DIALOG);

    mission.applyOnStartRules();
  }