Exemple #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.qtplace);

    // Set spinner content
    spnService = (Spinner) findViewById(R.id.spnPlace);
    ArrayAdapter<String> spnAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spnArr);
    spnAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spnService.setAdapter(spnAdapter);

    // Set mapview content
    mapView = (MapView) findViewById(R.id.map_view);
    mapController = mapView.getController();

    mapView.setBuiltInZoomControls(true);

    // Get prefrences
    mapController.animateTo(testpoint);
    mapController.setZoom(14);

    // Set current location
    LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    LocationListener ll = new myLocationListenner();
    lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);

    // Get distance
    txtDistance = (EditText) findViewById(R.id.txtDistance);

    // Set pointer in map
    mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.google_map_marker);
    itemizeOverlay = new CustomItemizeOverlay(drawable, this);
  }
  @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);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Displaying Zooming controls
    MapView mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);

    MapController mc = mapView.getController();
    double lat = Double.parseDouble("10.35410"); // latitude
    double lon = Double.parseDouble("123.91145"); // longitude
    GeoPoint geoPoint = new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));
    mc.animateTo(geoPoint);
    mc.setZoom(15);
    mapView.invalidate();

    List<Overlay> mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.marker);
    AddItemizedOverlay itemizedOverlay = new AddItemizedOverlay(drawable, this);

    OverlayItem overlayitem = new OverlayItem(geoPoint, "Hello", "Talamban Campus");

    itemizedOverlay.addOverlay(overlayitem);
    mapOverlays.add(itemizedOverlay);
  }
Exemple #4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.maptab);
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    layout1 = (LinearLayout) findViewById(R.id.maptab1);
    //		layout2 = (LinearLayout)findViewById(R.id.maptab2);

    BroadcastReceiver myReceiver =
        new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
            Toast.makeText(context, "브로드캐스팅", 1000).show();
            //				layout1.setVisibility(View.GONE);
            //				layout2.setVisibility(View.VISIBLE);
          }
        };
    IntentFilter filter = new IntentFilter("bbb");
    registerReceiver(myReceiver, filter);

    final MapController mc = mapView.getController();
    GeoPoint point = new GeoPoint(37298025, 126972817);
    mc.animateTo(point);
    mc.setZoom(16);

    putBoardMarker();
  }
Exemple #5
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // MapView and Controller
    map = (MapView) findViewById(R.id.map);
    map.setBuiltInZoomControls(true);
    myMapController = map.getController();
    myMapController.setZoom(17);

    // MyLocationOverlay
    myLocationOverlay = new MyLocationOverlay(this, map);
    myLocationOverlay.enableMyLocation();
    map.getOverlays().add(myLocationOverlay);

    // Get Overlays
    mapOverlays = map.getOverlays();
    drawable = this.getResources().getDrawable(R.drawable.marker);
    itemizedOverlay = new HelloItemizedOverlay(drawable);

    // Add Marker on RP E6
    GeoPoint point = new GeoPoint(1445450, 103784260);
    OverlayItem overlayitem = new OverlayItem(point, "Hello!", "This is Republic Polytechnic E6");

    itemizedOverlay.addOverlay(overlayitem);
    mapOverlays.add(itemizedOverlay);
  }
  public void showBudburstSpeciesOnMap(boolean hasHandler) {

    // TODO Auto-generated method stub
    otDBH = new OneTimeDBHelper(MapViewMain.this);

    GeoPoint gPoint = new GeoPoint((int) (mLatitude * 1000000), (int) (mLongitude * 1000000));

    mMapView.setBuiltInZoomControls(true);
    mMapView.invalidate();

    if (getMyListsFromDB()) {
      Log.i("K", "Get species lists from the database");

      // add overlays on the map
      mMapView.getOverlays().clear();
      mMapView.getOverlays().add(new SpeciesMapOverlay(mMapView, mMarker, mPlantList));
      mMapView.getOverlays().add(mMyOverLay);

      titleBar.setText("Total number of species : " + mPlantList.size());

      mMapController.setCenter(gPoint);

      if (hasHandler) {
        mHandlerDone = true;
        mHandler.sendEmptyMessage(GET_MY_OBSERVED_LISTS);
        mMapController.setZoom(12);
      }
    } else {
      Toast.makeText(MapViewMain.this, "Please make your own observation", Toast.LENGTH_SHORT)
          .show();
      Log.i("K", "No species lists in the database.");
    }
  }
Exemple #7
0
 @Override
 public boolean dispatchKeyEvent(KeyEvent event) {
   if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) {
     zoomValue = zoomValue + 1;
     mc.setZoom(zoomValue);
   } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN) {
     zoomValue = zoomValue - 1;
     mc.setZoom(zoomValue);
   } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT) {
     mMode = false;
     changeMapMode();
   } else if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT) {
     mMode = true;
     changeMapMode();
   }
   return super.dispatchKeyEvent(event);
 }
 protected void setPointerFromCursor(Cursor c, int zoomLevel) {
   final GeoPoint gp = MapsUtils.getGeoPoint(c);
   if (mCurrentPointer == null || !mCurrentPointer.equals(gp)) {
     setPointer(gp);
     mMapController.setCenter(gp);
     mMapController.setZoom(zoomLevel);
     mCurrentPointer = gp;
   }
 }
Exemple #9
0
 private void setupMap() {
   mapView = (MapView) findViewById(R.id.mapLocation);
   mapView.setBuiltInZoomControls(true);
   mapView.setSatellite(false);
   mc = mapView.getController();
   drawable = this.getResources().getDrawable(R.drawable.arrow);
   list = mapView.getOverlays();
   mc.setZoom(15); // 1 ~ 21
 }
Exemple #10
0
  private void initMapView() {
    mapView = (MapView) findViewById(R.id.mapview);
    mapCtrl = mapView.getController();

    final int maxZoomLevel = mapView.getMaxZoomLevel() - zoomCorrection;
    mapCtrl.setZoom(maxZoomLevel);
    mapView.setBuiltInZoomControls(true);
    mapView.setSatellite(true);
  }
Exemple #11
0
  public void navigaleToMapItem(int itemType, String itemIndex) {
    mapItem item = findItem(itemType, itemIndex);

    if (item != null) {
      mc.animateTo(item.gp);
      mc.setZoom(mZoomMax);
    } else {
      navigateToPoint(parent.naviPoint);
    }
  }
Exemple #12
0
  void updateLocation(final double lat, final double lon) {
    _lastPosition = Position.valueOf(lat, lon);

    Log.d(TAG, "Starting updateLocation " + lat + ", " + lon);

    Log.d(TAG, "My Location: " + _myLocationOverlay.getMyLocation());
    _mc.animateTo(new GeoPoint((int) Math.round(lat * 1E6), (int) Math.round(lon * 1E6)));
    _mc.setZoom(DEFAULT_ZOOM_VALUE);

    getAndDisplayResultsFor(lat, lon);
  }
Exemple #13
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
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    map = (MapView) findViewById(R.id.mvMain);
    map.setBuiltInZoomControls(true);
    Touchy t = new Touchy(); // Overlay para detectar toques en lapantalla
    oveList = map.getOverlays(); // obtiene todos los overlays que se dibujan en el mapa
    oveList.add(t); // agrega nuestro overlay de ultimo en la lista
    compass =
        new MyLocationOverlay(
            MainActivity.this, map); // se crea un nuevo Overlay de la localizacion actual
    oveList.add(compass); // se agrega el overlay de la localizacion
    controller = map.getController(); // se obtinenen los controles del mapa
    GeoPoint point = new GeoPoint(51643234, 7848593); // se crea un nuevo Geopoint
    controller.animateTo(point); // se indica a los controles que nos lleven al punto indicado
    controller.setZoom(6); // se hace un zoon de nivel 6
    d =
        getResources()
            .getDrawable(
                R.drawable.ic_launcher); // se crea un objeto dibujable por medio de un recurso

    // placing pintpoint at location
    lm =
        (LocationManager)
            getSystemService(Context.LOCATION_SERVICE); // manager para la localizacion GPS
    Criteria crit =
        new Criteria(); // un objeto criterio que maneja el mejor criterio de selleccion del
    // provider
    towers = lm.getBestProvider(crit, false); // se obtiene un proveedor de localizacion
    Location location =
        lm.getLastKnownLocation(towers); // se obtine la localizacion del provedor seleccionado

    // si hay una localizacion
    if (location != null) {
      lat = (int) location.getLatitude(); // se obtiene la lat  y long
      lon = (int) location.getLongitude();
      GeoPoint ourLocation = new GeoPoint(lat, lon); // se crea un nuevo punto
      // se crea un overlay para mostrar un dibujo en el punto indicado por la lat y lon
      OverlayItem overlayItem = new OverlayItem(ourLocation, "what's up", "2nd string");
      CustonPinpoint custom =
          new CustonPinpoint(
              d, MainActivity.this); // se crea un punto personal con el objeto dibujable
      custom.insertPinpoint(overlayItem); // se le dan los datos de la posicion en el mapa
      oveList.add(custom); // se agrega el punto en la lista de overlays
    } else {
      // cuando todo se va al carajo
      Toast.makeText(MainActivity.this, "no se puede encontrar un provider", Toast.LENGTH_LONG)
          .show();
    }
  }
Exemple #15
0
  @SuppressLint("NewApi")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_show_map);

    // Check for Geocoder
    geocoderAvailable =
        Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && Geocoder.isPresent();

    // Get the Map View and configure
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);
    mapView.setSatellite(true);
    mapController = mapView.getController();
    mapController.setZoom(18);

    // Handler for updating text fields on the UI like the lat/long and address
    handler =
        new Handler() {
          public void handleMessage(Message msg) {
            switch (msg.what) {
              case UPDATE_ADDRESS:
                mAddress.setText((String) msg.obj);
                break;
              case UPDATE_LATLNG:
                mLatLng.setText((String) msg.obj);
                break;
            }
          }
        };

    // Reference LocationManager object
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    // Create an overlay that shows current location
    myLocationOverlay = new MyLocationOverlay(this, mapView);
    mapView.getOverlays().add(myLocationOverlay);

    myLocationOverlay.runOnFirstFix(
        new Runnable() {
          public void run() {
            mapView.getController().animateTo(myLocationOverlay.getMyLocation());
          }
        });

    Drawable drawable =
        this.getResources().getDrawable(R.drawable.ic_maps_indicator_current_position);
    itemizedOverlay = new MyOverlays(this, drawable);
    createMarker();
  }
Exemple #16
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setActionBarContentView(R.layout.mapslist);
    initActionBar();

    Bundle bundle = getIntent().getExtras();
    session = bundle.getString("session");

    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);
    controlMap = mapView.getController();

    // Server Connection and convert response to string
    sc = new ServerConnection(this);
    String params = getResources().getString(R.string.llistatXarxes) + "?session=" + session;
    String result = sc.getDataConnection(params);

    // Recogemos los puntos
    // parse json data
    try {
      OverlayItem itemNet;
      JSONArray jArray = new JSONArray(result);

      prepareDraw();

      for (int i = 0; i < jArray.length(); i++) {
        JSONObject json_data = jArray.getJSONObject(i);
        itemNet =
            new OverlayItem(
                new GeoPoint(
                    (int) (json_data.getDouble("Lat") * 1E6),
                    (int) (json_data.getDouble("Lon") * 1E6)),
                json_data.getString("Nom"),
                null);
        int idXarxa = json_data.getInt("IdXarxa");
        itemizedOverlay.addOverlay(idXarxa, itemNet);
      }
      mapView.getOverlays().clear();
      mapView.getOverlays().add(itemizedOverlay);

      // Recogemos el centro de los puntos y lo centramos
      GeoPoint point = itemizedOverlay.getCenter();
      controlMap.animateTo(point);

    } catch (JSONException e) {
      Log.e("log_tag", "Error parsing data " + e.toString());
    }
    controlMap.setZoom(8);
  }
  private void inicializeMap() {
    mapView = (MapView) findViewById(R.id.map);
    mapView.setBuiltInZoomControls(true);
    mapController = mapView.getController();
    mapController.setZoom(16);
    if (latitud != 0 && longitud != 0) {
      int lat = (int) (latitud * 1E6);
      int lon = (int) (longitud * 1E6);

      mapController.animateTo(new GeoPoint(lat, lon));
      mapController.setCenter(new GeoPoint(lat, lon));
    }
    centerMyPosition();
  }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.activity_guidemap);

    guideMapView = (MapView) findViewById(R.id.guideMapView);
    guideMapView.setBuiltInZoomControls(true);

    Intent intent = getIntent();
    GeoPoint geoPoint = getGeoPoint(intent.getStringExtra("msg"));

    MapController mapController = guideMapView.getController();
    mapController.setCenter(geoPoint);
    mapController.setZoom(18);
  }
 /**
  * Deze functie zet de meegegeven parameter, dit is een aders of plaats om naar een adres object
  * en zorgt ervoor dat de kaart op dit adres wordt gecentreerd en ingezoomd
  *
  * @param location
  * @return GeoPoint
  */
 public GeoPoint createGeopoint(String location) {
   Geocoder geoCoder = new Geocoder(getBaseContext(), Locale.getDefault());
   List<Address> start = null;
   try {
     start = geoCoder.getFromLocationName(location, 1);
   } catch (IOException e) {
     e.printStackTrace();
   }
   p =
       new GeoPoint(
           (int) (start.get(0).getLatitude() * 1E6), (int) (start.get(0).getLongitude() * 1E6));
   mc.animateTo(p);
   mc.setZoom(13);
   return p;
 }
Exemple #20
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.i("K", "PBBMapMain - onCreate");

    super.onCreate(savedInstanceState);

    setContentView(R.layout.pbb_map);

    mLocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    // Set MapView and the longPressListener
    mMapView = (MapCustomView) findViewById(R.id.map);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setSatellite(false);

    // set long press listener
    longPressListener();

    // Set mapController
    mMapController = mMapView.getController();
    mMapController.setZoom(12);

    // Add mylocation overlay
    mMyOverLay = new MyLocationOverlay(MapViewMain.this, mMapView);
    mMyOverLay.enableMyLocation();
    mMyOverLay.enableCompass();

    // remove view of accuracy bar
    titleBar = (TextView) findViewById(R.id.myloc_accuracy);
    titleBar.setVisibility(View.GONE);

    Intent pIntent = getIntent();
    mType = pIntent.getExtras().getInt("type", 100);

    // initialize plantList
    mPlantList = new ArrayList<HelperPlantItem>();

    // initialize marker
    mMarker = getResources().getDrawable(R.drawable.marker);
    mMarker.setBounds(0, 0, mMarker.getIntrinsicWidth(), mMarker.getIntrinsicHeight());

    IntentFilter inFilter = new IntentFilter(HelperGpsHandler.GPSHANDLERFILTER);
    registerReceiver(gpsReceiver, inFilter);
    Log.i("K", "Receiver Register");

    showButtonOnMap();
    checkGpsIsOn();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_activity);

    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);

    double intentLatitude = getIntent().getDoubleExtra(Constants.EXTRA_POINT_LAT, 0.0);
    double intentLongitude = getIntent().getDoubleExtra(Constants.EXTRA_POINT_LON, 0.0);

    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mZoom = ZOOM_GLOBAL;

    if ((intentLatitude != 0.0) && (intentLongitude != 0.0)) {
      // the activity has been lauched with a commune's coordinate in extras
      mMapCenter = GeoUtils.convertLatLon(intentLatitude, intentLongitude);
      mZoom = ZOOM_FOCUSED;

    } else if (Constants.DEMO) {
      double lat = 47.07;
      double lon = 4.88;
      mMapCenter = GeoUtils.convertLatLon(lat, lon);
    } else {
      String provider = mLocationManager.getBestProvider(criteria, true);
      Location location = mLocationManager.getLastKnownLocation(provider);
      if (location != null) {
        mMapCenter = GeoUtils.convertGeoPoint(location);
      } else {
        double lat = 47.07;
        double lon = 4.88;
        mMapCenter = GeoUtils.convertLatLon(lat, lon);
      }
    }
    mMapView = (POIMapView) findViewById(R.id.mapview);
    mMapView.setBuiltInZoomControls(true);
    mMapController = mMapView.getController();
    mMapController.setZoom(mZoom);
    mMapController.animateTo(mMapCenter);
    mMapView.setSatellite(MODE_SATELLITE);
    mMapView.setOnPanChangeListener(this);

    mHandler = new UIHandler();

    initOverlay();
    updateUI();
  }
    @Override
    protected Boolean doInBackground(Void... params) {

      List<Overlay> mapOverlays = mMap.getOverlays();
      mapOverlays.clear();
      /*
       * Where i am
       */
      Drawable meDrawable = getResources().getDrawable(R.drawable.me);
      CustomItemizedOverlay meItemizedOverlay = new CustomItemizedOverlay(meDrawable, mContext);
      GeoPoint mePoint =
          new GeoPoint(
              (int) (getLocation().getLatitude() * 1e6),
              (int) (getLocation().getLongitude() * 1e6));
      OverlayItem meOverlayitem = new OverlayItem(mePoint, "Hello", "I'm here");
      meItemizedOverlay.addOverlay(meOverlayitem);
      mapOverlays.add(meItemizedOverlay);

      records = GDGApi.getRecords(mContext, messageUtil);
      if (records != null && records.size() > 0) {
        for (int i = 0; i < records.size(); i++) {
          Record rec = records.get(i);
          Drawable drawable = null;
          if (rec.user.equals(mUserName)) {
            drawable = getResources().getDrawable(R.drawable.my_post);
          } else {
            drawable = getResources().getDrawable(R.drawable.other);
          }
          CustomItemizedOverlay itemizedOverlay = new CustomItemizedOverlay(drawable, mContext);
          itemizedOverlay.record = rec;
          GeoPoint point =
              new GeoPoint((int) (rec.locLatitude * 1e6), (int) (rec.locLongitude * 1e6));
          OverlayItem overlayitem = new OverlayItem(point, rec.title, rec.body);
          itemizedOverlay.addOverlay(overlayitem);
          mapOverlays.add(itemizedOverlay);
        }
      } else {
        messageUtil.showToastMessage(getString(R.string.error_no_records));
      }

      MapController mapController = mMap.getController();
      mapController.animateTo(mePoint);
      mapController.setZoom(12);

      return false;
    }
 @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();
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Get a reference to the MapView
    MapView myMapView = (MapView) findViewById(R.id.myMapView);

    // Get the Map View's controller
    mapController = myMapView.getController();

    // Configure the map display options
    myMapView.setSatellite(true);
    myMapView.setBuiltInZoomControls(true);

    // Zoom in
    mapController.setZoom(17);

    // Add the MyPositionOverlay
    positionOverlay = new MyPositionOverlay();
    List<Overlay> overlays = myMapView.getOverlays();
    overlays.add(positionOverlay);
    myMapView.postInvalidate();

    LocationManager locationManager;
    String svcName = Context.LOCATION_SERVICE;
    locationManager = (LocationManager) getSystemService(svcName);

    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(false);
    criteria.setSpeedRequired(false);
    criteria.setCostAllowed(true);
    String provider =
        LocationManager.GPS_PROVIDER; // locationManager.getBestProvider(criteria, true);

    Location l = locationManager.getLastKnownLocation(provider);

    updateWithNewLocation(l);

    locationManager.requestLocationUpdates(provider, 2000, 10, locationListener);
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    global_app = (SupervisorApplication) getApplication();
    decimalFormat = new DecimalFormat("#.########");

    setContentView(R.layout.layout_default_map);
    searchButton = (Button) findViewById(R.id.search);
    searchButton.setOnClickListener(this);
    searchButton.setOnTouchListener(this);
    logo = (Button) findViewById(R.id.logo);
    logo.setOnClickListener(this);
    logo.setOnTouchListener(this);

    lastLocation = global_app.getLastLocation();
    // Log.d(TAG, "lastLocation: LAT: " + Double.toString(lastLocation.getLatitude()) + " LON: " +
    // Double.toString(lastLocation.getLongitude()));

    userMarker = getResources().getDrawable(R.drawable.me);
    currentMarker = getResources().getDrawable(R.drawable.current_marker);
    pendingMarker = getResources().getDrawable(R.drawable.pending_marker);
    doneMarker = getResources().getDrawable(R.drawable.done_marker);
    cancelMarker = getResources().getDrawable(R.drawable.cancel_marker);

    try {
      taskId = getIntent().getExtras().getLong("taskId");
      Log.d(TAG + "task id", Long.toString(taskId));
      animateToTaskPosition = true;
    } catch (NullPointerException e) {
      animateToTaskPosition = false;
    }

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

    mapController = mapView.getController();
    mapController.setZoom(16);

    receiver = new TaskUpdateReceiver();
    filter = new IntentFilter(SupervisorApplication.UPDATE_VIEW_INTENT);
    registerReceiver(receiver, filter);
  }
  private void initScene() {
    // Get the mapView object from the xml layout
    mapView = (MapView) findViewById(R.id.mapView);

    // Allow user to zoom in and out
    mapView.setBuiltInZoomControls(true);

    // Grabs the controller of the mapView
    mapController = mapView.getController();

    // Initially zooms in to predefined level
    mapController.setZoom(16);

    // Grabs the location service from the android system
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    // Initializes the location listener with listener defined below
    locationListener = new MapLocationListener();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapa = (MapView) findViewById(R.id.mapaView);

    // Instancia do controlador do mapa
    controlador = mapa.getController();

    // Instancia ums imagem (overlay) que representar� o usuario no mapa
    LocalUserOverlay imagem = new LocalUserOverlay(new PontoIzabel(), R.drawable.red_ball);
    mapa.getOverlays().add(imagem);

    // centraliza o mapa em uma determinada coordenada
    controlador.animateTo(new PontoIzabel());

    // Centraliza o mapa na ultima localizacao conhecida
    LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
    /* Location local = getLocationManager().getLastKnownLocation(LocationManager.GPS_PROVIDER);

    if(local != null){   //Se existe ultima localizacao converte para GeoPoint

    	Ponto ponto = new Ponto(local);minTime
    	//Instancia ums imagem (overlay) que representar� o usuario no mapa
    	 imagem = new LocalUserOverlay (ponto, R.drawable.red_ball);
         mapa.getOverlays().add(imagem);
    	controlador.setCenter(ponto);
    }else{
    	getMensage("Aviso", "N�o foi possiver rastrear nova localiza��o");
    }

    //GPS Listener
    getLocationManager().requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);*/

    mapa.setStreetView(true); // configura pra mostrar o mapa no modo street
    mapa.setClickable(true);
    // define o zoom do mapa
    controlador.setZoom(19);
    mapa.setBuiltInZoomControls(true);
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   mMapView = (MapView) findViewById(R.id.mapview);
   mSearchEditText = (EditText) findViewById(R.id.searchtext);
   mMapController = mMapView.getController();
   mControlPanel = (RelativeLayout) findViewById(R.id.control_panel);
   mMapModeView = (ImageView) findViewById(R.id.map_mode);
   mSatelliteModeView = (ImageView) findViewById(R.id.sat_mode);
   mTrafficModeView = (ImageView) findViewById(R.id.traffic_mode);
   mSearchbar = (LinearLayout) findViewById(R.id.searchbar);
   // Pre-load the tiles so that maps can get loaded faster.
   mMapView.preLoad();
   // Turn on the map mode and set the zoom level.
   mMapController.setZoom(MAP_ZOOM_LEVEL);
   mMapView.setSatellite(false);
   mMapView.setBuiltInZoomControls(true);
   mSearchEditText.setFocusable(true);
   setSearchEditorActionListner();
 }
Exemple #29
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    aq = new AQuery(this);
    transportListPattern = Pattern.compile("(\\s*\\w+\\d*,*\\s*)+");
    transportNumberPatern = Pattern.compile("№\\s*(\\d+\\w*)");

    setContentView(R.layout.activity_main);
    MapView mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    MapController mapController = mapView.getController();

    DBConnector connector = new DBConnector(this);
    options = connector.getOptions();
    if (options == null) {
      options = new Options(10, "136, 32"); // defailtOptions;
    }
    mapController.setZoom(options.getZoom());
    ReuestToServer();
  }
Exemple #30
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);
  }