use of com.google.android.gms.maps.model.MarkerOptions in project HumaneApp by Ganesh1010.
the class MapActivity method onMapReady.
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
mGoogleMap.setOnMyLocationButtonClickListener(this);
mGoogleMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
@Override
public void onMapLongClick(LatLng latLng) {
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
latitude = latLng.latitude;
longitude = latLng.longitude;
location = new LatLng(latitude, longitude);
mCurrLocationMarker = mGoogleMap.addMarker(new MarkerOptions().position(new LatLng(latitude, latLng.longitude)).draggable(true).visible(true).title(getAaddress(latitude, longitude)));
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 17));
}
});
mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//Initialize Google Play Services
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
//Location Permission already granted
buildGoogleApiClient();
mGoogleMap.setMyLocationEnabled(true);
} else {
//Request Location Permission
checkLocationPermission();
}
} else {
buildGoogleApiClient();
mGoogleMap.setMyLocationEnabled(true);
}
}
use of com.google.android.gms.maps.model.MarkerOptions in project HumaneApp by Ganesh1010.
the class MapActivity method onMyLocationButtonClick.
@Override
public boolean onMyLocationButtonClick() {
System.out.println("current location");
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
location = new LatLng(cur_latitude, cur_longitude);
location = new LatLng(cur_latitude, cur_longitude);
latitude = cur_latitude;
longitude = cur_longitude;
mCurrLocationMarker = mGoogleMap.addMarker(new MarkerOptions().position(location).title(getAaddress(cur_latitude, cur_longitude)));
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 17));
return true;
}
use of com.google.android.gms.maps.model.MarkerOptions in project Remindy by abicelis.
the class EditLocationBasedReminderFragment method updateMapView.
private void updateMapView() {
if (mMap != null && mReminder != null) {
mMap.clear();
// Add a marker for this item and set the camera
BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.icon_marker);
LatLng loc = new LatLng(mReminder.getPlace().getLatitude(), mReminder.getPlace().getLongitude());
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 13f));
mMap.addMarker(new MarkerOptions().position(loc).icon(icon));
}
}
use of com.google.android.gms.maps.model.MarkerOptions in project Remindy by abicelis.
the class PlaceActivity method drawMarkerWithCircle.
/* Map Camera, Marker and Circle helper methods */
private void drawMarkerWithCircle(LatLng position, double circleRadiusInMeters) {
//red outline
int strokeColor = 0xffff0000;
//opaque red fill
int shadeColor = 0x44ff0000;
CircleOptions circleOptions = new CircleOptions().center(position).radius(circleRadiusInMeters).fillColor(shadeColor).strokeColor(strokeColor).strokeWidth(2);
if (mPlaceCircle != null)
mPlaceCircle.remove();
mPlaceCircle = mMap.addCircle(circleOptions);
MarkerOptions markerOptions = new MarkerOptions().position(position);
if (mPlaceMarker != null)
mPlaceMarker.remove();
mPlaceMarker = mMap.addMarker(markerOptions);
mPlaceCircle.setZIndex(100);
}
use of com.google.android.gms.maps.model.MarkerOptions in project google-io-2014 by romainguy.
the class DetailActivity method setupMap.
private void setupMap() {
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
double lat = getIntent().getDoubleExtra("lat", 37.6329946);
double lng = getIntent().getDoubleExtra("lng", -122.4938344);
float zoom = getIntent().getFloatExtra("zoom", 15.0f);
LatLng position = new LatLng(lat, lng);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(position, zoom));
map.addMarker(new MarkerOptions().position(position));
}
Aggregations