google-maps-android-api-2

Issue on removing item from clustermanager

假装没事ソ 提交于 2019-11-30 07:10:37
问题 In my Android application, I have to delete and re-add a cluster item in my GoogleMap, that represents my current location. But when I run this code: clusterMng.remove(myitem); I get this Exception: java.lang.UnsupportedOperationException: NonHierarchicalDistanceBasedAlgorithm.remove not implemented. Can someone explain to me what this means? Do I have to rewrite some methods of ClusterManager.java in the external library? Or can I simply change my algorithm? 回答1: By default ClusterManager

Google Map API v2 is not showing Map on device

*爱你&永不变心* 提交于 2019-11-30 06:02:43
I am running sample code that is provided on Google Map Documentation for Google Map Api v2 ( https://developers.google.com/maps/documentation/android/start#specify_settings_in_the_application_manifest ). The code run successfully but Map is not loaded on the device. Only white screen is shown on the device. I am using 4.0.3 version Android device. 1) I enabled service for the project. 2) Generated key: 3) "google-play-services_lib" as Library in project: 4) Android Manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package=

Android Google Maps v2 - Add object to marker

落爺英雄遲暮 提交于 2019-11-30 06:01:52
How can we add an object to a marker in the new Google Maps Android API v2 ? So if we click on the InfoWindow , we can do something with the object? public void addSpotOnMap(Spot spot) { getMap().addMarker(new MarkerOptions() .position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getParseGeoPoint().getLongitude())) .title(spot.getName()) .snippet(spot.getCategory()) .draggable(false)); } This sets the location, title and snippet for the object. But I want to be able to go to another activity about this specific Spot-object if I click on the InfoWindow Not really sure if this is the

Recycle Android Maps V2 SupportMapFragment when rotating

假如想象 提交于 2019-11-30 05:19:44
I am looking to improve the performance of the SupportMapFragment when the device is rotated. It seems as if the fragment must be recreated. I am not sure of this, however when the device is rotated the map tiles must be reloaded. It would make sense from a performance perspective to have the entire mapfragment retained and reused without having to re-instantiate the fragment. Any insight into this would be appreciated. I am declaring the SupportMapFragment in xml and using the SetupMapIfNeeded() as described in the api docs. private void setUpMapIfNeeded() { // Do a null check to confirm that

navigation drawer google maps v2 , map blocking drawer

坚强是说给别人听的谎言 提交于 2019-11-30 05:04:15
I have this problem when opening drawer on gingerbread and behind is google map v2. Map that should be on screen behind gets on top of everything. Now I could bypass this by hiding map when drawer opens and show it when closes but I'm looking for more elegant solution if someone came up with any? There is a bug with google maps api v2 and black space. Maybe you have got similar problem. For solutions look here: https://github.com/jfeinstein10/SlidingMenu/issues/228 and here: https://github.com/jfeinstein10/SlidingMenu/issues/168 As far as I remember solutions are one of this: extending Google

Getting Google Map Fragment in onCreateView using ActionBar tabs

家住魔仙堡 提交于 2019-11-30 03:53:41
问题 I'm trying to retrieve the Google Map fragment while using Tabs in an ActionBar. When I load the tabbed page the map loads fine, but I want to get the map object so I can center it, add markers etc. Is there a way to do this and if there is, would somebody be so kind to show me how? Here's the code for my tabbed page... The specific method I'm working with is public static class Map extends Fragment public class Page3Activity extends FragmentActivity implements ActionBar.TabListener { final

Android: how to notify Activity when Fragments views are ready?

对着背影说爱祢 提交于 2019-11-30 03:30:29
I'm using Google Maps API V2 in an activity wih drop down navigation where the map is on the second position. I'm adding the map pragmatically like: mMapFragment = supportMapFragment.newInstance(); getSupportFragmentManager() .beginTransaction() .replace(R.id.placeHolder, mMapFragment, TAG_MAP) .commit(); I want to get the GoogleMap ovject, as the documentation https://developers.google.com/maps/documentation/android/map say it should be done with mMapFragment.getMap() , but it returns null. according to http://developer.android.com/reference/com/google/android/gms/maps/SupportMapFragment.html

get Lat Lang from a place_id returned by autocomplete place api

让人想犯罪 __ 提交于 2019-11-30 03:07:43
I am searching the place in my apps using the google autocomplete place api and now I want to get latitude and longitude of the place that i have searched. How to get latitude and longitude from the result returned by autocomplete place api by google in android? droidmad The following code snippet which uses Google Places API for android worked for me Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId) .setResultCallback(new ResultCallback<PlaceBuffer>() { @Override public void onResult(PlaceBuffer places) { if (places.getStatus().isSuccess()) { final Place myPlace = places.get(0);

How to remove all the polylines from a map

[亡魂溺海] 提交于 2019-11-30 03:04:11
Following How to draw a path between two markers I had to add lot of polylines between two markers, to make a path. One of the markers is draggable, lets say source is draggable. So, when user starts dragging the marker, the path previously drawn must be erased and a new path between new source and destination must be draw. I am able to draw the new path, but how can i erase the previous path? This is how the path is drawn: for (int z = 0; z < list.size() - 1; z++) { LatLng src = list.get(z); LatLng dest = list.get(z + 1); Polyline line = map.addPolyline(new PolylineOptions() .add(new LatLng

Creating OnDragListener for Google Map v2 Fragment

情到浓时终转凉″ 提交于 2019-11-30 02:06:46
I’m trying to setup an onDrag Listener for a google map fragment, but can’t get the drag event to fire. Since the map doesn't support drag events directly, I'm trying to implement a drag listener for the View. I know about the onMarkerDrag event, but that does me no good since I'm not trying to move markers around. The reason for trapping map drag events is twofold: First to detect if the user has panned the map. If they haven't, I like to keep their location on the screen, and animate to their location if it's not on the map. If they have panned the map, I assume they know what they want to