Java Code Examples for com.google.android.gms.maps.model.MarkerOptions#snippet()
The following examples show how to use
com.google.android.gms.maps.model.MarkerOptions#snippet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkerActivity.java From Complete-Google-Map-API-Tutorial with Apache License 2.0 | 6 votes |
private void addMarkersToMap() { MarkerOptions options =new MarkerOptions(); options.position(BRISBANE); options.title("brisbane"); options.snippet("Population: 2,544,634"); options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)); options.draggable(true); CustomInfoWindowAdapter.brisbane=googleMap.addMarker(options); MarkerOptions options2 =new MarkerOptions(); options2.position(ADELAIDE); options2.title("adelaide"); options2.snippet("Population: 3,543,222"); Drawable drawable=ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_person_pin_circle_black_24dp); options2.icon(convertDrawableToBitmap(drawable)); options2.draggable(true); CustomInfoWindowAdapter.adelaide=googleMap.addMarker(options2); }
Example 2
Source File: MapWrapper.java From osmdroid with Apache License 2.0 | 6 votes |
@Override public void addMarker(final Marker aMarker) { final MarkerOptions marker = new MarkerOptions(); marker.position(new LatLng(aMarker.latitude, aMarker.longitude)); if (!TextUtils.isEmpty(aMarker.title)) { marker.title(aMarker.title); } if (!TextUtils.isEmpty(aMarker.snippet)) { marker.snippet(aMarker.snippet); } if (aMarker.bitmap != null) { marker.icon(BitmapDescriptorFactory.fromBitmap(aMarker.bitmap)); } else { if (aMarker.icon != 0) { marker.icon(BitmapDescriptorFactory.fromResource(aMarker.icon)); } } if (aMarker.anchor == Marker.Anchor.CENTER) { marker.anchor(0.5f, 0.5f); } mGoogleMap.addMarker(marker); }
Example 3
Source File: GeoJsonPointStyle.java From android-maps-utils with Apache License 2.0 | 6 votes |
/** * Gets a new MarkerOptions object containing styles for the GeoJsonPoint * * @return new MarkerOptions object */ public MarkerOptions toMarkerOptions() { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.alpha(mMarkerOptions.getAlpha()); markerOptions.anchor(mMarkerOptions.getAnchorU(), mMarkerOptions.getAnchorV()); markerOptions.draggable(mMarkerOptions.isDraggable()); markerOptions.flat(mMarkerOptions.isFlat()); markerOptions.icon(mMarkerOptions.getIcon()); markerOptions.infoWindowAnchor(mMarkerOptions.getInfoWindowAnchorU(), mMarkerOptions.getInfoWindowAnchorV()); markerOptions.rotation(mMarkerOptions.getRotation()); markerOptions.snippet(mMarkerOptions.getSnippet()); markerOptions.title(mMarkerOptions.getTitle()); markerOptions.visible(mMarkerOptions.isVisible()); markerOptions.zIndex(mMarkerOptions.getZIndex()); return markerOptions; }
Example 4
Source File: MapActivity.java From Bus-Tracking-Parent with GNU General Public License v3.0 | 5 votes |
private void addMarker(LatLng location, String time) { if (mGoogleMap != null) { MarkerOptions mMarkerOption = new MarkerOptions(); mMarkerOption.position(location); mMarkerOption.title("Bus is here"); mMarkerOption.snippet(time); mMarkerOption.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_directions_bus_black_24dp)); removeMarker(); mMarker = mGoogleMap.addMarker(mMarkerOption); } }
Example 5
Source File: MainActivity.java From ExamplesAndroid with Apache License 2.0 | 5 votes |
@Override protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) { BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.mipmap.davidhackro); markerOptions.icon(icon); markerOptions.snippet(item.getTitle()); markerOptions.title(item.getSubtitle()); markerOptions.position(item.getPosition()); super.onBeforeClusterItemRendered(item, markerOptions); }
Example 6
Source File: MapMarker.java From android-app with GNU General Public License v2.0 | 5 votes |
private MarkerOptions getMarker(Bus bus) { MarkerOptions options = new MarkerOptions(); LatLng position = new LatLng(bus.getLatitude(), bus.getLongitude()); options.position(position); options.anchor(0.0f, 1.0f); options.icon(getIcon(bus.getTimestamp())); options.snippet(new Gson().toJson(bus)); return options; }
Example 7
Source File: MapMarker.java From android-app with GNU General Public License v2.0 | 5 votes |
private MarkerOptions getMarker(Spot spot, float hueColor, Itinerary itinerary) { MarkerOptions options = new MarkerOptions(); LatLng position = new LatLng(spot.getLatitude(), spot.getLongitude()); options.position(position); options.anchor(0.0f, 1.0f); options.icon(BitmapDescriptorFactory.defaultMarker(hueColor)); options.snippet(new Gson().toJson(itinerary)+">"+spot.getReturning()); return options; }
Example 8
Source File: LocationActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void updatePlacesMarkers(ArrayList<TLRPC.TL_messageMediaVenue> places) { if (places == null) { return; } for (int a = 0, N = placeMarkers.size(); a < N; a++) { placeMarkers.get(a).marker.remove(); } placeMarkers.clear(); for (int a = 0, N = places.size(); a < N; a++) { TLRPC.TL_messageMediaVenue venue = places.get(a); try { MarkerOptions options = new MarkerOptions().position(new LatLng(venue.geo.lat, venue.geo._long)); options.icon(BitmapDescriptorFactory.fromBitmap(createPlaceBitmap(a))); options.anchor(0.5f, 0.5f); options.title(venue.title); options.snippet(venue.address); VenueLocation venueLocation = new VenueLocation(); venueLocation.num = a; venueLocation.marker = googleMap.addMarker(options); venueLocation.venue = venue; venueLocation.marker.setTag(venueLocation); placeMarkers.add(venueLocation); } catch (Exception e) { FileLog.e(e); } } }
Example 9
Source File: ChatAttachAlertLocationLayout.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void updatePlacesMarkers(ArrayList<TLRPC.TL_messageMediaVenue> places) { if (places == null) { return; } for (int a = 0, N = placeMarkers.size(); a < N; a++) { placeMarkers.get(a).marker.remove(); } placeMarkers.clear(); for (int a = 0, N = places.size(); a < N; a++) { TLRPC.TL_messageMediaVenue venue = places.get(a); try { MarkerOptions options = new MarkerOptions().position(new LatLng(venue.geo.lat, venue.geo._long)); options.icon(BitmapDescriptorFactory.fromBitmap(createPlaceBitmap(a))); options.anchor(0.5f, 0.5f); options.title(venue.title); options.snippet(venue.address); VenueLocation venueLocation = new VenueLocation(); venueLocation.num = a; venueLocation.marker = googleMap.addMarker(options); venueLocation.venue = venue; venueLocation.marker.setTag(venueLocation); placeMarkers.add(venueLocation); } catch (Exception e) { FileLog.e(e); } } }
Example 10
Source File: MainActivity.java From effective_android_sample with Apache License 2.0 | 5 votes |
/** * 戦場1つを描画する */ private void drawField(Field field) { // マーカー定義 MarkerOptions markerOptions = new MarkerOptions(); markerOptions.title(field.getName()); // 名前を設定 markerOptions.snippet(field.getMemo()); // 説明を設定 markerOptions.position(calcCenter(field.getVertexes())); // マーカーの座標を設定(区画の中心を自動算出) markerOptions.icon(BitmapDescriptorFactory.defaultMarker(field.getColorHue())); // 色を設定 // マップにマーカーを追加 mGoogleMap.addMarker(markerOptions); // 区画を描画 final LatLng[] vertexes = field.getVertexes(); if (vertexes != null && vertexes.length > 3) { // ポリゴン定義 PolygonOptions polygonOptions = new PolygonOptions(); // RGBそれぞれの色を作成 final int[] colorRgb = field.getColorRgb(); int colorRed = colorRgb[0]; int colorGreen = colorRgb[1]; int colorBlue = colorRgb[2]; // 区画の輪郭について設定 polygonOptions.strokeColor(Color.argb(0x255, colorRed, colorGreen, colorBlue)); polygonOptions.strokeWidth(5); // 区画の塗りつぶしについて設定 polygonOptions.fillColor(Color.argb(0x40, colorRed, colorGreen, colorBlue)); // 各頂点の座標を設定 polygonOptions.add(vertexes); // LatLngでもLatLng[]でもOK // マップにポリゴンを追加 mGoogleMap.addPolygon(polygonOptions); } }
Example 11
Source File: MapActivity.java From Bus-Tracking-Parent with GNU General Public License v3.0 | 4 votes |
private void forRecentRide() { // get details from intent String start_gps = getIntent().getStringExtra("start_gps"); String end_gps = getIntent().getStringExtra("end_gps"); String start_time = getIntent().getStringExtra("start_time"); String end_time = getIntent().getStringExtra("end_time"); String current_gps = getIntent().getStringExtra("current_gps"); LatLong sGps = new LatLong(start_gps); LatLong eGps = new LatLong(end_gps); LatLong cGps = new LatLong(current_gps); if (sGps.isValid()) { start_time = DateTimeUtils.getTime(start_time); end_time = DateTimeUtils.getTime(end_time); MarkerOptions s_options = new MarkerOptions(); s_options.position(new LatLng(sGps.getLat(), sGps.getLon())); s_options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE)); s_options.title("Started :" + start_time); s_options.snippet(LocationHelper.getLocationName(this, sGps.getLat(), sGps.getLon())); addCustomMarker(s_options); if (eGps.isValid()) { // draw line //addLine(new LatLng(sGps.getLat(), sGps.getLat()), new LatLng(eGps.getLat(), eGps.getLon())); MarkerOptions e_options = new MarkerOptions(); e_options.position(new LatLng(eGps.getLat(), eGps.getLon())); e_options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); e_options.title("Completed :" + end_time); e_options.snippet(LocationHelper.getLocationName(this, eGps.getLat(), eGps.getLon())); addCustomMarker(e_options); } else if (cGps.isValid()) { // draw line //addLine(new LatLng(cGps.getLat(), cGps.getLat()), new LatLng(sGps.getLat(), sGps.getLon())); MarkerOptions c_options = new MarkerOptions(); c_options.position(new LatLng(cGps.getLat(), cGps.getLon())); c_options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); c_options.title("Incomplete ?"); c_options.snippet(LocationHelper.getLocationName(this, cGps.getLat(), cGps.getLon())); addCustomMarker(c_options); } } }
Example 12
Source File: DefaultClusterRenderer.java From android-maps-utils with Apache License 2.0 | 3 votes |
/** * Called before the marker for a ClusterItem is added to the map. The default implementation * sets the marker and snippet text based on the respective item text if they are both * available, otherwise it will set the title if available, and if not it will set the marker * title to the item snippet text if that is available. * * The first time {@link ClusterManager#cluster()} is invoked on a set of items * {@link #onBeforeClusterItemRendered(ClusterItem, MarkerOptions)} will be called and * {@link #onClusterItemUpdated(ClusterItem, Marker)} will not be called. * If an item is removed and re-added (or updated) and {@link ClusterManager#cluster()} is * invoked again, then {@link #onClusterItemUpdated(ClusterItem, Marker)} will be called and * {@link #onBeforeClusterItemRendered(ClusterItem, MarkerOptions)} will not be called. * * @param item item to be rendered * @param markerOptions the markerOptions representing the provided item */ protected void onBeforeClusterItemRendered(@NonNull T item, @NonNull MarkerOptions markerOptions) { if (item.getTitle() != null && item.getSnippet() != null) { markerOptions.title(item.getTitle()); markerOptions.snippet(item.getSnippet()); } else if (item.getTitle() != null) { markerOptions.title(item.getTitle()); } else if (item.getSnippet() != null) { markerOptions.title(item.getSnippet()); } }