Questions tagged [google-maps-android-api-2]

Google Android Maps Api v2 is the next generation of Google Maps SDK available for Android developers.

Related tags:

Useful links:

3484 questions
55
votes
10 answers

Add bounds to map to avoid swiping outside a certain region

My app shows a map and i want that users can't swipe over a certain region. So i'm trying to add bounds but it makes the app to crash. Here is the working code: public class MapViewer extends Activity implements OnInfoWindowClickListener { …
smartmouse
  • 13,912
  • 34
  • 100
  • 166
55
votes
4 answers

Get driving directions using Google Maps API v2

I am trying to get the driving direction between the two positions: LatLng(12.917745600000000000,77.623788300000000000) LatLng(12.842056800000000000,7.663096499999940000) The code which i have tried: Polyline line = mMap.addPolyline(new…
Anukool
  • 5,301
  • 8
  • 29
  • 41
54
votes
4 answers

Manage Google Maps API Key with Gradle in Android Studio

I know Gradle is powerful and I would like to manage the API keys for development/produciton of Google Maps Currently I always need to manually comment one line and uncomment the other to make it work. Is there a way to do it automatically in Gradle…
Hrk
  • 2,725
  • 5
  • 29
  • 44
54
votes
5 answers

How to draw interactive Polyline on route google maps v2 android

i have the following code which is drawing polylines for me and working fine, But the problem is that its not drawing interactive polylines, drawn lines are missing some pixels ! import java.io.BufferedReader; import java.io.IOException; import…
Tarsem Singh
  • 14,139
  • 7
  • 51
  • 71
53
votes
12 answers

java.lang.noclassdeffounderror: com.google.android.gms.R$styleable

I am creating an android application using google maps. here is the code: MapFragActivity.java import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.google.android.gms.maps.GoogleMap; import…
Himanshu
  • 573
  • 1
  • 9
  • 15
52
votes
2 answers

Should I use MapView or MapFragment

I am not sure whether I should be using MapView or stick to using a MapFragment. My application is an app that finds the nearest set of places that are closest to you. I want to be able to add locations, display details of a marker when I press a…
51
votes
5 answers

How to convert a LatLng and a radius to a LatLngBounds in Android Google Maps API v2?

I believe this is a limitation of the recent Google Maps API v2. They have recently added the ability to draw a Circle on the ground - but if you want to position the camera such that it shows the entire Circle, there exists no way to do so. One can…
Warlax
  • 2,459
  • 5
  • 30
  • 41
51
votes
8 answers

Capture screen shot of GoogleMap Android API V2

Final Update The feature request has been fulfilled by Google. Please see this answer below. Original Question Using the old version of the Google Maps Android API, I was able to capture a screenshot of the google map to share via social media. I…
DiscDev
  • 38,652
  • 20
  • 117
  • 133
50
votes
11 answers

How can I handle map move end using Google Maps for Android V2?

I want to geocode address as soon as map center has been changed. How can I handle map moveend with new Google Maps for Android V2? (I'm talking about the case then user drags map by finger)
49
votes
3 answers

Changing colour of Markers - Google Map V2 Android

I'm having a little trouble understanding how to change the colour of a marker in an Android Google Map project. My code for a Marker is: googlemap.addMarker(new MarkerOptions() .position(new LatLng( 65.07213,-2.109375)) .title("This is my…
user1977908
  • 1,105
  • 4
  • 11
  • 16
47
votes
1 answer

Error: MapFragment cannot be cast to android.support.v4.app.Fragment

First, I watched out here: Start FragmentActivity from Activity and now I have the following problem: MapsActivity: public class MapsActivity extends FragmentActivity { private GoogleMap mMap; @Override public void onCreate(Bundle…
Hsnbrg
  • 779
  • 3
  • 7
  • 14
46
votes
4 answers

zoom level listener in google maps v2 in android

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.
45
votes
4 answers

Android: automatically choose debug/release Maps v2 api key?

I'm using Google Maps v2 API in my project. In Google Maps v2 the debug/release API key is defined in AndroidManifest.xml. I have seen the link but in that map key is defined in a xml layout file not in AndroidManifest.xml. So can I define both…
45
votes
6 answers

Google android maps api v2 Show Marker Title Always

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?
43
votes
8 answers

Google Maps Android API v2 - Sample Code crashes

I'm trying to get the sample code of Android 'Google Maps Android API v2' working. I get the project built without errors. However, when I try to run the app on my Galaxy Nexus (connected with usb to my laptop), the app crashes immediately. I…
alexx
  • 603
  • 1
  • 6
  • 8