google-maps-android-api-2

Convert Android App that uses maps API V1 to Maps Android API V2

ぃ、小莉子 提交于 2019-11-29 02:36:00
I have an android app that uses the old Maps API, it's now deprecated! What steps I should take to make my app works with the new API. I'm using also Distance Matrix API and Google Directions API. my code will work with it ?! You can take a look at this blog post I wrote on how to create a Map application using: Google Map API V2 guide Basically the changes you would have to make are 1. Replace the MapView object with a MapFragment or SupportMapFragment object (depending on the target SDK of your application) 2. In additin you will have to repalce the MapActivity with a normal Activity (if you

Android Maps Library V2 zoom controls custom position

ぃ、小莉子 提交于 2019-11-29 01:48:15
问题 How can i customize the position of the builtin zoom controls in a GoogleMap V2 ? There are a lot of questions related to this topic for the Version 1 of Google Maps library. Placing Zoom Controls in a MapView How to reposition built-in zoom controls in MapView? How to layout zoom Control with setBuiltInZoomControls(true)? However, i wasn't able to find any questions in relation to the V2 of the library. In the V2, there's no method (LinearLayout) mapView.getZoomControls(); all the previously

BadParcelableException in google maps code

情到浓时终转凉″ 提交于 2019-11-29 01:29:58
Running slightly modified example of Google Maps throws BadParcelableException in the Google Maps code. The LatLng class is parcelable but it cannot be found. It seems that Google Maps code is trying to unparcel the object that was not parcelled by it. What cases the problem? package com.example.mapdemo; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import android.os.Bundle; public class RawMapViewDemoActivity extends android.support.v4.app

Getting a map marker by its ID in Google Maps v2

半腔热情 提交于 2019-11-29 01:00:49
问题 basically when adding a marker to the map it returns the new marker and you can gets the marker id from it like so Marker m = map.addMarker(new MarkerOptions() .position(new LatLng(lat,lon))); String id = m.getId(); is there a way to get a marker by its id if there are many markers and you just want to delete one? 回答1: The problem is that the marker id is generated automaticlly and cannot be used for tracking the markers individually. A number of strategies have been proposed work around this

Picasso image loading issue in GoogleMap.InfoWindowAdapter

心已入冬 提交于 2019-11-28 23:59:14
I am using Google Maps Api and want to show an image inside InfoWindow when clicking of a Marker. I implemented it but there is a problem about Picasso. When I click a marker, infoWindow is shown up and imageView shows placeholder image. If I click same marker one more time, Picasso loads the image succesfully. I have to click twice, it is so weird. Screenshots for better understanding: First click on the marker: When I click again: There is my codes below: InfoWindowAdapter (Picasso loading here) mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { @Override public View getInfoWindow

How to remove all the polylines from a map

≡放荡痞女 提交于 2019-11-28 23:37:58
问题 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);

Multiple maps v2 in TabActivity

ε祈祈猫儿з 提交于 2019-11-28 23:01:51
问题 I'm currently trying to have 2 maps v2 in different tabs of a TabActivity using MapView objects. The problem arises in the following scenario: tab1 with a map is displayed go to tab2 in order to display another map in this second tab looks like the map image from first tab is overlapping the new map. See the following picture: On the right you can see how the first map is still displayed on top of it. The touch events are going to the new map but that doesn't really help. I spent a lot of

Google map API v2 is not working

安稳与你 提交于 2019-11-28 22:00:15
I am trying to run sample code mention here : Google Maps Android API V2 Sample code but i am getting error NoClassDefFound. Below is my logcat. Can any one help me to solve it. Any help is highly appricated Thanks 12-04 18:04:18.854: E/AndroidRuntime(1801): java.lang.ExceptionInInitializerError 12-04 18:04:18.854: E/AndroidRuntime(1801): at java.lang.Class.newInstanceImpl(Native Method) 12-04 18:04:18.854: E/AndroidRuntime(1801): at java.lang.Class.newInstance(Class.java:1319) 12-04 18:04:18.854: E/AndroidRuntime(1801): at android.app.Instrumentation.newActivity(Instrumentation.java:1053) 12

How to smoothly keep moving current location marker in Google Maps v2 android

拟墨画扇 提交于 2019-11-28 21:41:07
I have placed a marker for my location. I would like to move my marker smoothly something like the Google maps app. The blue circle moves very smoothly when I keep moving in my car. I would like implement the same for my app. how do I implement this on my app? As of now my location marker just jumps for different location on very location change and marks the marker there. Here is what I have don: googleMap.setMyLocationEnabled(true); So onMyLocationChange method is called automatically: @Override public void onMyLocationChange(Location location) { curlat = location.getLatitude(); curlong =

Open Street Maps with Android Google Maps Api v2

痴心易碎 提交于 2019-11-28 21:27:31
Is it possible to use an open street map provider with the new Google Maps V2 Api on Android? If so can you provide an example, or documentation? I have looked quickly at the docs and found UrlTileProvider() , so it looks likely this is possible. Bonus: Is simply using the MapFragment class with OSM tiles still bound by the Google Maps TOS? You need to extend the UrlTileProvider class so you can define the URL for OSM tiled maps and add a tile overlay like that : MyUrlTileProvider mTileProvider = new MyUrlTileProvider(256, 256, mUrl); mMap.addTileOverlay(new TileOverlayOptions().tileProvider