google-maps-android-api-2

Android Google Maps fragment in the xml. I get “Unexpected namespace prefix”

ぃ、小莉子 提交于 2019-11-27 01:14:34
问题 I'm trying to learn android, and having followed the instructions on how to use the Google Maps API V.2 I now got it working. However, the instructions on how to configure the initial state of the maps, found at developers.google.com, suggests a namespace defined in the xml-file, in this case "map". The xml-code below gives med the error "Unexpected namespace prefix "map" ". Trying to define the xmlns:map inside the fragment tag gave the same error but with "xmlns". I'm obviously missing some

MapFragment in Fragment, alternatives?

徘徊边缘 提交于 2019-11-27 01:06:25
问题 I need your help... I work on it until 3 days. My app is working with fragments. One of these fragments has to display a map from the Google Maps V2 api for Android. Currently, I'm using a MapFragment, but no surprise, a fragment in a fragment is not a good idea, but it works, the map is displaying, i can edit it but when I switch of main fragment and return on it. Caused by: java.lang.IllegalArgumentException: Binary XML file line #59: Duplicate id 0x7f070041, tag null, or parent id

How to animate marker in android map api V2?

蹲街弑〆低调 提交于 2019-11-27 00:27:59
I want to implement smooth transition to emulate car marker moving on the map. Is it possible to animate marker in android map api v2? Try out the below code to animate the marker on Google Map V2. You need to use the Interpolator class to apply the animation on the Marker and handle it in the Handler for the animation as below: public void animateMarker(final Marker marker, final LatLng toPosition, final boolean hideMarker) { final Handler handler = new Handler(); final long start = SystemClock.uptimeMillis(); Projection proj = mGoogleMapObject.getProjection(); Point startPoint = proj

NoSuchFieldError: No static field MapAttrs of type when Using MapFragment with Play Services 6.5

你说的曾经没有我的故事 提交于 2019-11-27 00:21:34
问题 Maybe I am missing something here, but I am not able to use the new Maps only dependency in Play Services 6.5 I get the following exception: java.lang.NoSuchFieldError: No static field MapAttrs of type [I in class Lcom/google/android/gms/R$styleable; or its superclasses (declaration of 'com.google.android.gms.R$styleable' appears in /data/app/com.kaching.merchant.dev1-1/base.apk) at com.google.android.gms.maps.GoogleMapOptions .createFromAttributes(Unknown Source) at com.google.android.gms

android java.io.IOException: Service not Available

亡梦爱人 提交于 2019-11-27 00:21:32
问题 Description: I am using Google maps API V2 .I have implemented Android Reverse Geocoding at touched location. Problem: It throws exception on try { addresses = geocoder.getFromLocation(latitude, longitude,1);} catch (IOException e) { e.printStackTrace(); if(AppConstants.DEBUG)Log.v(AppConstants.DEBUG_TAG," e.printStackTrace(): "+e.getMessage()); } I am receiving latitude and longitude values correct, but i can't understand why it throws exception and i have also done Google search but it

Showing custom InfoWindow for Android Maps Utility Library for Android

六眼飞鱼酱① 提交于 2019-11-27 00:07:57
问题 I'm using the library Google Maps Utility for Android which allows to create clustering int he maps and I need to show a custom InfoWindow but I can't find any method to do this. In order to show the info window, I have the following class, and in the method onClusterItemRendered is where I have access to the info of the marker: class MyClusterRenderer extends DefaultClusterRenderer<MarkerItem> { public MyClusterRenderer(Context context, GoogleMap map, ClusterManager<MarkerItem>

Android Google Maps v2 - set zoom level for myLocation

孤街浪徒 提交于 2019-11-26 22:44:39
问题 Is it possible to change the zoom level for myLocation with the new Google Maps API v2? If you set GoogleMap.setEnableMyLocation(true); you get a button on the map to find your location. If you click on it, the map will bring you to your location and zoom it in to some level. Can I change this zoom to be less or more? 回答1: It's doubtful you can change it on click with the default myLocation Marker. However, if you would like the app to automatically zoom in on your location once it is found,

Android Geocoder getFromLocationName always returns null

人盡茶涼 提交于 2019-11-26 22:42:01
I have been trying to geocode a string to get its coordinates but my program always crashes because when ever I try to use getFromLocationName() it returns null . I have been trying to fix this for hours but nothing is working. Here is my code public class MainActivity extends Activity { private GoogleMap mMap; List<Address> addresses; MarkerOptions miami; String myLocation = "Miami,Florida"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (mMap == null) { mMap = ((MapFragment) getFragmentManager()

Polygon Touch detection Google Map API V2

情到浓时终转凉″ 提交于 2019-11-26 22:35:13
I'm trying to figure out how best to do this, I have a map with one Polygon drawn on it. Since it doesn't seem as though the Google Maps API V2 has a touch detection on a Polygon. I was wonder if it is possible to detect whether the touch point is inside the Polygon? If so then how, my main goal is to outline a state on a map and when the user taps that state it will show more details inside a custom view. As of now I am able to capture the MapOnClick of the map but when the user taps inside the Polygon I want the polygon.getID() set on the Toast . I am a newbie so I apologize if I am not

How to create direction arrows for my polylines in android

自古美人都是妖i 提交于 2019-11-26 22:02:07
问题 what i need to add for PolylineOptions polyline = new PolylineOptions(); polyline.addAll(geom); polyline.color(defaultStrokeColor).width(defaultWidth); mapObjects.add(polyline); this code to display the arrow head? 回答1: I have seen other questions/answers about this that use markers and rotate them. But there is a simpler way to have directional arrows on GoogleMap Polylines. The GoogleMap API v2 provides a slick way to do this by adding an " endcap " icon to the PolylineOptions. It takes