google-maps-android-api-2

Google Maps Utility: how to get all markers from ClusterManager<?>?

心不动则不痛 提交于 2019-12-01 01:40:17
问题 Sorry for my English I tried the ClusterManager<?>.getMarkerCollection().getMarkers() method but it returns empty collection. I use in my app Google Maps Utility Library . Every time after a screen rotation I create AsynkTask and in background thread read data from DB and add items to ClusterManager : cursor.moveToFirst(); while (!cursor.isAfterLast()) { SomeData row = readSomeDataRow(cursor); clusterManager.addItem(new ClusterItemImpl(row)); cursor.moveToNext(); } When the AsyncTask finished

How to link Google Maps Android API v2 Marker to an object

自作多情 提交于 2019-12-01 01:37:57
I'm adding dynamically a non-fixed amount of markers in a map, which each of them are related to one instance of my POCO class. I need to link them so when the user clicks on one of the markers, I show the rest of the data inside the custom InfoWindow. What do you suggest? PS: I add new markers everytime the user pans or zooms the map and I worried about overloading the app. Are the non visible markers disposed? I suggest using a HashMap or something similar. As you iterate over your list of objects and create markers for them, also add the Marker to a list, using the ID of the object as the

Android SupportMapFragment.getMap() returns null

帅比萌擦擦* 提交于 2019-12-01 01:37:36
in my following code, getMap() returns null, which stop the app. If I don't do anything with the map (i.e, removing the last two lines), it shows correctly. Any idea why? Thanks. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); FragmentManager fragmentManager = getSupportFragmentManager(); SupportMapFragment mapFragment = SupportMapFragment.newInstance(); mapFragmentId = mapFragment.getId(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(R.id.my_container, mapFragment); transaction.commit

Google Map is not loaded for the app downloaded from the Play Store

跟風遠走 提交于 2019-12-01 00:34:11
I use Google Map in my app. When I install the app from my pc using Eclipse, the Google Map is loaded properly. Now I uploaded the app to the Google Play Store for distribution. For the app installed from the Play Store, Google Map is not loaded. What is wrong or which step am I missing? EDIT 1: Now I get the SHA1 fingerprint from the release keystore. Then I go to the Google APIs Console and using exiting project and that fingerprint, I created new Android API Key. That new API key is replaced with my old debug API Key and then I export a new apk again. That apk is uploaded to the play store.

Google Service Location API needs internet?

痞子三分冷 提交于 2019-12-01 00:32:10
问题 I am learning the Google Maps API V2 and now I am reading about the Location API , the documents says it connects a client to the Service : Location Services sends the current location to your app through a location client, which is an instance of the Location Services class LocationClient. All requests for location information go through this client. Does this means that Google will be getting all the positions where my app is? I know Google Maps can work in offline mode if the maps are

Google Maps Android MapView v2: disable zooming

∥☆過路亽.° 提交于 2019-12-01 00:02:52
问题 Is there a way to disable the zooming (pinch and double tap) in the MapView but keep the scrolling? This means setting clickable to false would not work. I have also tried setting an onTouch listener in the activity but it will not trigger using: mapView.setOnTouchListener(this); 回答1: You can assign those properties using the XML file: map:uiRotateGestures="true" map:uiScrollGestures="true" map:uiTiltGestures="true" map:uiZoomGestures="true" So use: map:uiZoomGestures="false" On the

SupportMapFragment Instead of MapFragment

时间秒杀一切 提交于 2019-11-30 23:59:46
I want to make an android application that uses Google Maps for Android v2. I can show a map. I can even navigate and zoom. But, when I want to search for more operations to make, I can't find any. I want this application to work on API level 8 and above. So, I used SupportMapFragment . I heard that, if I want to make my application to work on API level 8 and above, I have to use SupporMapFragment . I found examples about MapFragment s, but unfortunately, not about SupportMapFragment . I want to make these operations work in my application, however, they're using MapFragment : One Two Is there

Is it possible to set dimensions to a groundOverlay that is independent of the map zoom level?

╄→гoц情女王★ 提交于 2019-11-30 21:26:28
I have a GroundOverlay on my GoogleMap and I want that its dimensions to not change when I zoom in/out on map. Exact like default map markers that always keep their dimensions. I have tried with both forms of the GroundOverlay.setDimensions() but the image is still resize on zoom. Here is my code: Bitmap btm = BitmapFactory.decodeResource(getResources(), R.drawable.map_arrow); BitmapDescriptor arrow = BitmapDescriptorFactory.fromBitmap(btm); float w = btm.getWidth(); float h = btm.getHeight(); if (groundOverlay != null) groundOverlay.remove(); groundOverlay = mMap.addGroundOverlay(new

Android Google Maps API v2: get my bearing location

眉间皱痕 提交于 2019-11-30 21:21:14
I would like to force the camera to behave like you are using navigation, it means when you rotate 90° left, the camera does the same thing. I have a Google Map where my location (as a blue dot) is shown. mGoogleMap.setMyLocationEnabled(true); When I am moving, blue dot is with an arrow which shows my current bearing. I would like to get this bearing. I am getting my current location using FusedLocationApi : currentLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); Code below is animating camera to current location, but without the bearing. I can add the bearing,

How do I select a marker using the Maps V2 Android API?

瘦欲@ 提交于 2019-11-30 21:10:36
I am currently using the ItemizedOverlay class from the Maps V1 API, which keeps track of what marker (if any) is currently selected. Is there any similar functionality in Maps V2 to determine which marker is currently selected? Also, is there a way to programatically select a new marker? Yes. To determine which marker is selected, add a OnInfoWindowClickedListener to your GoogleMap: //mMap is an instance of GoogleMap mMap.setOnInfoWindowClickListener(getInfoWindowClickListener()); Override the onInfoWindowClicked() method inside of the OnInfoWindowClickListener: public