google-maps-markers

CursorIndexOutOfBoundsException problem:Index 4 requested, with a size of 4

南楼画角 提交于 2019-12-02 04:27:13
I want to display for each maker an AlertDialog that has some description, for that, i'm using this code: protected boolean onTap(int index) { db = openHelper.getWritableDatabase(); String[] result_columns = new String[] {COL_DESCRI}; Cursor cur = db.query(true, TABLE_COORD, result_columns, null, null, null, null, null, null); cur.moveToPosition(index); String description = cur.getString(cur.getColumnIndexOrThrow("description")); AlertDialog.Builder dialog = new AlertDialog.Builder(Geo.this); dialog.setTitle("Infos."); dialog.setMessage(description); dialog.setPositiveButton("OK", new

Google Maps Android API v2 - Add a marker failed

♀尐吖头ヾ 提交于 2019-12-02 03:51:12
I found a solution . The map may not have been initialized yet, try getMap() in a later point of the lifecycle, like onResume() My code is protected void onResume() { super.onResume(); int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); if (resultCode == ConnectionResult.SUCCESS){ Toast.makeText(getApplicationContext(), "isGooglePlayServicesAvailable SUCCESS", Toast.LENGTH_LONG).show(); if(gMap == null){ gMap = mMapView.getMap(); if(gMap != null){ gMap.setMyLocationEnabled(true); gMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); }else{ Toast.makeText

Android Google Maps resize marker on Zoom

牧云@^-^@ 提交于 2019-12-02 03:14:07
问题 I need to display around 30 markers in a somewhat small area. Is there a way to resize Google Maps API V2 markers when the user changes the zoom? Or should I just use a smaller image? Thanks in advance! 回答1: If you want to do something when zooming, you can create a custom Mapview which extends the original MapView, and just override dispatchDraw(Canvas canvas). With adding a little listener, you can do whatever you want in the callback. Something like this; @Override protected void

How do I clean up an InfoWindow when the associated Marker is hidden?

£可爱£侵袭症+ 提交于 2019-12-02 02:07:52
I know that many of us are writing code to open an InfoWindow when a marker is clicked. But the InfoWindow will stay in place until the upper-right X is clicked, which means that setting the associated Marker visibility to false will create what is essentially an orphaned InfoWindow . And there could be multiple InfoWindow instances displayed on the Map at the same time. I guess it's simple enough for the user to just click the InfoWindow closed, but it feels like hiding the Marker should hide the associated InfoWindow . I have started writing code like the following to deal with this scenario

GoogleMap Markers are Not Clickable on the Mobile Devices

丶灬走出姿态 提交于 2019-12-02 01:42:13
GoogleMap Markers are Not Clickable on the Mobile Devices (Touch Screens). But, ok on any PC, so I can't figure out what is the point. Here is my code: var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(60.037760, -44.100494), mapTypeId: google.maps.MapTypeId.ROADMAP }); var locations = [ ['4lvin', 60.074433, -44.011917], ['5irius', 60.037760, -44.100494] ]; for (var i = 0; i < locations.length; i++) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map }); var infowindow = new

Maps marker point image with picasso not loaded at first time

房东的猫 提交于 2019-12-02 01:09:25
I'm implementing android Mapview with Custom marker. I'm using picasso to load image into marker view. And when i launch the app at the first time, it shows me all the markers, but only one marker that has loaded from database with picasso, the other markers are not loaded from database, they only show me the default maps marker pin. But when i go to the previous activity and go back into MapsActivity, it shows me all the markers that loaded from database with picasso. Here's my PicassoMarker class public class PicassoMarker implements Target { Marker mMarker; PicassoMarker(Marker marker) {

Google Map Dialog/Info Window Not Appearing on Touch

安稳与你 提交于 2019-12-02 01:06:07
I am trying to add infowindows to markers/pushpins on the map. ATM, it is not working. Current code: TravelBuddy.java/TabHost package com.jappapps.android.travelbuddy; import java.util.List; import android.app.TabActivity; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.webkit.WebView; import android.widget.TabHost; import android.widget.TabHost.TabSpec; import com.google.android.maps.Overlay; public class TravelBuddy extends TabActivity { TabHost mTabHost; /** Called when the activity is first

add marker with Google-Maps-for-Rails

我是研究僧i 提交于 2019-12-02 00:53:18
I was playing with https://github.com/apneadiving/Google-Maps-for-Rails and i'd like to clear all the marker on a map and add a new one at the position clicked by the user on the map, I added the following code in my page <script type="text/javascript" charset="utf-8"> function gmaps4rails_callback() { google.maps.event.addListener(Gmaps4Rails.map, 'click', function(object){ alert(object.latLng); }); </script> And in this way i can see an alert with the lat and long value, now how can i delete the old markers and create a new marker and place it on the map? If you want to clear markers created

How can I display a different icon for markers that fit wthin different categories?

℡╲_俬逩灬. 提交于 2019-12-02 00:07:48
I'm attempting to make a Google Map which allows the user to check off a category and have those specific locations display. I've got that part working: http://thedenvillehub.com/test-hs/adv/scripts/test.html What I want to do is have a different icon come up for each category, so that one is red, one is blue, etc. I found a couple of examples online but nothing seems to be working for me. Here's my code for reference: var markers = new Array(); var locations = [ ['Boonton Town', '402-9410', 'Dial-a-Ride', 40.902, -74.407, 1 ], ['Boonton Township', '331-3336', 'Dial-a-Ride', 40.933, -74.425, 2

Capture Google Maps Polyline On Click (Per Start/End)

眉间皱痕 提交于 2019-12-02 00:05:32
问题 Description I am currently working with Google Maps V3 for our client and they've asked us to implement a drawing tool that will allow them to create connected stream of lines and calculate the distance. However, it seems the Google Maps V3 Drawing Manager library is very limited in how it allows us to capture the click events for a polyline. Our Code google.maps.event.addListener(map, 'click', function(event){ //TODO: Store lat/long of click for distance calculation later }); google.maps