google-maps-android-api-2

How to put drawable as a background on InfoWindow (Google Maps API v2 for Android)?

自作多情 提交于 2019-11-28 21:17:47
This is my custom layout for my info window: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/bg_infowindow" > <LinearLayout android:id="@+id/text_box" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <TextView style="@style/TexTitle" android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView style="@style/TextDistance" android:id="@+id/distance" android:layout

Google Maps API v2 Android add shape drawable as marker

时光毁灭记忆、已成空白 提交于 2019-11-28 21:09:11
I've been trying to add a shape drawable as the marker icon for a marker I want to add on the map. shape looks like this (res/drawable/blue_circle.xml): <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <size android:width="15dp" android:height="15dp" /> <solid android:color="@color/Blue" /> </shape> and I try to add the marker like this: markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.blue_circle)); Apparently I get a NullPointer exception. Must the marker icon be a bitmap? Am I allowed to add

Google android maps api v2 Show Marker Title Always

泪湿孤枕 提交于 2019-11-28 21:06:26
I have a google maps v2 in my android application and some markers on it. When user click one of these markers, a title popup comes. How can I show these titles always without user click? Just call Marker.showInfoWindow(); . See https://developers.google.com/maps/documentation/android/marker#info_windows and https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Marker#showInfoWindow() José De la O Something like that: googleMap.addMarker(new MarkerOptions() .position(new LatLng(latitude, longitude)) .title("Your position")).showInfoWindow();

Associate an object with Marker (google map v2)

吃可爱长大的小学妹 提交于 2019-11-28 20:56:40
问题 In my app I have some objects that have their location displayed on the map using markers. The problem is that the only way I've found to handle marker clicks is googleMap.setOnMarkerClickListener(new ... { @Override public void onMarkerClick(Marker marker) { // how to get the object associated to marker??? } }) In other words I get the Marker object while the only interface that I have allows me to set just MarkerOptions. Any way to associate Marker with an object? 回答1: You can associate

How to send google maps location info through SMS as a link

℡╲_俬逩灬. 提交于 2019-11-28 20:43:35
In an application that I'm building, I am trying to send my location info(Lat,Long/ Geocoded) to my emergency contact list. I am assuming that all my recipients are using smartphones(Android/iOS) Until now, the application sends my location info as a string through SMS: "I am at: " + Some Geocoded Location However, I thought that this is not an optimal way of sending the exact location info. So, I was thinking if it was possible to generate a map through Google Maps API with a pinpoint/dot on it, and send a link to that map. Can this be done in Device level(Without contacting any servers) Or,

Clear markers from Google Map in Android

天涯浪子 提交于 2019-11-28 19:59:27
I have added map on fragment activity and added several marker using addMarker function, but i am able to remove all markers , I am getting notification for different list of markers, Now i wants to remove all markers and add new one. one way to keep all markers in list and remove one by one, (marker.remove()) Is there any better way to clear all marker. If you want to clear "all markers, overlays, and polylines from the map", use clear() on your GoogleMap . 来源: https://stackoverflow.com/questions/15663793/clear-markers-from-google-map-in-android

Where is com.google.android.gms?

孤街醉人 提交于 2019-11-28 19:26:09
Today I updated Android SDK components to the newest version and somehow the whole com.google.android.gms package is gone. Instead, there is only com.google.android.maps with different classes than those in gms package. Is it a big change form Google or have I done something wrong? I have been using GoogleMap and LatLng classes to work with google maps and now I have just errors in my project. Is it a big change form Google or have I done something wrong? com.google.android.gms comes from the Play Services SDK, which you attach to your application project as an Android library project. Please

Google maps v2: Authorization failure

为君一笑 提交于 2019-11-28 19:10:52
Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map. Ensure that the following correspond to what is in the API Console: Package Name: com.company.app , API Key: AIzaSyC***OsTeo , Certificate Fingerprint: 4E5285***6BF53ED3 Failed to contact Google servers. Another attempt will be made when connectivity is established. Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors). I know there are more then enough questions about this subject. But

zoom level listener in google maps v2 in android

为君一笑 提交于 2019-11-28 18:35:53
I'm developing an Android app that is supposed to use Google Maps v2. Now i'm stuck at finding when zoom level of map has changed. Can anyone help me?Thanks in advance. Create an implementation of OnCameraChangeListener , and pass an instance of it to setOnCameraChangeListener() of your GoogleMap . Your listener should be called with onCameraChange() whenever the user changes the zoom, center, or tilt. You find out the new zoom level from the CameraPosition object that you are passed. If you're looking for how to determine if the zoom level has changed from the previous zoom level, here's what

NullPointerException when using RelativeLayout as custom InfoWindow

青春壹個敷衍的年華 提交于 2019-11-28 17:34:04
问题 I'm trying to use a RelativeLayout as custom InfoWindow for my markers, but a I get a NullPointerException every time showInfoWindow is called (via tapping on a Marker or programmatically). I'm using Google Maps Android API v2. Exception: FATAL EXCEPTION: main java.lang.NullPointerException at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:465) at android.view.View.measure(View.java:15172) at maps.a.y.i(Unknown Source) at maps.a.y.a(Unknown Source) at maps.a.w.a(Unknown Source)