marker

Opening InfoWindow automatically when adding marker Google Maps v2 Android

一曲冷凌霜 提交于 2019-11-27 04:11:28
Is there a way to open the infowindow automatically when we add a marker? Using this code to add the marker but infowindow only opens when clicking the marker: myMap.addMarker(new MarkerOptions() .position(latLng) .title("Title") .snippet("Snippet") .icon(BitmapDescriptorFactory .fromResource(R.drawable.marker))); According to the documents of Google Maps for Android V2 : An info window allows you to display information to the user when they tap on a marker on a map. By default, an info window is displayed when a user taps on a marker if the marker has a title set. Only one info window is

Android Custom marker icon

不打扰是莪最后的温柔 提交于 2019-11-27 03:46:35
问题 I'm working on application with Google maps so i want to define a custom marker for each custom place, For example (gas station- Hotel- Hospital.. ) ! i have a overlays class with the latitude and longitude of many places and i want just how to give a custom icon! 回答1: With the new Maps Api Setting the Icon for a Marker is done with the following Code: MarkerOptions markerOptions = new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_location)); The icon can not be

zoom to fit all markers on map google maps v2

不羁的心 提交于 2019-11-27 01:42:34
问题 I want to set the map zoom level to fit all markers on the map. I have used following method as said by many people, but it is not working for me. It is displaying some other point. if (positions.size() > 0) { final LatLngBounds.Builder builder = new LatLngBounds.Builder(); for (Marker m : positions) { builder.include(m.getPosition()); } builder.include(positions.get(i).getPosition()); } try { googleMap.setOnCameraChangeListener(new OnCameraChangeListener() { @Override public void

show info window on every marker at a time

柔情痞子 提交于 2019-11-27 01:33:26
问题 I want to show something like I am able to show all the markers on the map but I want to show info window on every markers whenever all the markers are populated. I've tried this so far but it shows all the markers with only one markers info window. for (int i = 0; i < jobsDtoList.size(); i++) { Double latitude = Double.parseDouble(jobsDtoList.get(i).getSiteLatitude()); Double longitude = Double.parseDouble(jobsDtoList.get(i).getSiteLongitude()); LatLng latLng = new LatLng(latitude, longitude

move marker on google maps api 2

十年热恋 提交于 2019-11-27 00:47:30
问题 How do I move marker on Google maps api V2 ? I am using below code but it does not move marker on the map. What am I doing wrong here ? This should work when location changes, so I have added onLocationChanged method and in that, am getting location details and trying to move marker on new details, but this doesn't work. Here is my code: import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.maps

Rotate marker as per user direction on Google Maps V2 Android

淺唱寂寞╮ 提交于 2019-11-27 00:38:45
问题 I want to rotate marker as per bearing or sensor value received from Accelerometer to show the user where actually he is moving. I have set marker icon and flat value to true but its not working as required. mCurrentLocationMarker.position(new LatLng( LocationUtils.sLatitude, LocationUtils.sLongitude)); mCurrentLocationMarker.icon(icon); mCurrentLocationMarker.flat(true); mCurrentLocationMarker.rotation(LocationUtils.sBearing); if (currentMarker != null) { currentMarker.setPosition(new LatLng

Multiple markers and infowindows on Google Maps (using MySQL)

血红的双手。 提交于 2019-11-26 23:44:09
问题 There are another four if statements which do the same thing for other categories. <?php if (isset($_POST['one'])) { $query = "SELECT * FROM beerstable WHERE category LIKE \"%Lager%\""; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } while ($row = mysql_fetch_assoc($result)) { $lat = $row['lat']; $lng = $row['lng']; $markername = $row['name']; $link = $row['link']; $photo = $row['photo']; ?> var infowindow = new google.maps.InfoWindow({ content: '<h1><

How to add title, snippet and icon to ClusterItem?

孤街醉人 提交于 2019-11-26 19:34:17
问题 I had this activity: public class MapViewer extends Activity { private GoogleMap map; private Database db = new Database(this); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mapviewer); try { map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); if (map != null) { map.setMyLocationEnabled(true); map.setMapType(GoogleMap.MAP_TYPE_NORMAL); map.getUiSettings().setRotateGesturesEnabled(false); this

myLocationOverlay change the marker

孤人 提交于 2019-11-26 16:32:49
问题 how do i change the default blue animated marker for MyLocationOverlay in google maps? 回答1: Step #1: Create a subclass of MyLocationOverlay . Step #2: Override drawMyLocation() and draw the marker however you like. Bear in mind that this method not only draws the marker, but "if the user's position moves near the edge of the screen, and we've been given a MapController in our constructor, we'll scroll to recenter the new reading". 回答2: Thx @CommonsWare, you led me in the right direction.

Add Marker on Android Google Map via touch or tap

安稳与你 提交于 2019-11-26 15:59:32
问题 I want to develop a Map Application using Google Map on Android. Now, I want to add marker on the map via Touch or Tap on the Map. How do I apply touch event to drop the marker on the map? 回答1: This code is Successful run I am working on that code this code is for Dynamic Draw I think this code help you more for Static or dynamic both places you can use this code double latval = Double.parseDouble(jsonobject.getString("lat")); double longval = Double.parseDouble(jsonobject.getString("lon"));