示例#1
0
  @Override
  public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    // Add a marker in Sydney and move the camera
    ubicacion = new Ubicacion(MapsActivity.this);
    currentLatLng = ubicacion.latLng();
    localizacion = new Localizacion(MapsActivity.this, currentLatLng);

    information = Arrays.toString(localizacion.gps()).replaceAll("\\[|\\]", "");
    mMap.addMarker(
        new MarkerOptions()
            .position(currentLatLng)
            .draggable(true)
            .title(information)
            .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(currentLatLng));
    cameraUpdate = CameraUpdateFactory.newLatLngZoom((currentLatLng), 16);
    mMap.animateCamera(cameraUpdate);
    preferences =
        new Preferences(
            getApplicationContext(),
            "Latitude,Longitude,CountryCode,Country, State, City, Address",
            String.valueOf(currentLatLng.latitude)
                + ","
                + String.valueOf(currentLatLng.longitude)
                + ","
                + information,
            "Laundry");
    preferences.savePreferences();
    mMap.setOnMarkerDragListener(this);
  }
示例#2
0
 @Override
 public void onMarkerDragEnd(Marker marker) {
   marker.hideInfoWindow();
   currentLatLng = marker.getPosition();
   localizacion = new Localizacion(MapsActivity.this, currentLatLng);
   information = Arrays.toString(localizacion.gps()).replaceAll("\\[|\\]", "");
   marker.setTitle(information);
   preferences =
       new Preferences(
           getApplicationContext(),
           "Latitude,Longitude, CountryCode,Country, State, City, Address",
           String.valueOf(currentLatLng.latitude)
               + ","
               + String.valueOf(currentLatLng.longitude)
               + ","
               + information,
           "Laundry");
   preferences.savePreferences();
 }