google-maps-android-api-2

Android Google Map : Heading is drawn wrongly, when I draw a line with specific length and heading on Google Map

…衆ロ難τιáo~ 提交于 2019-12-12 02:03:26
问题 I have a GoogleMap in my project. It's set in zoom level 21. I want to draw a line that is 5 meter in length with a specific heading. I used this code: private LatLng drawHeadingOnMap(LatLng centre, double radius, double heading) { double EARTH_RADIUS = 6378100.0; // Convert to radians. double lat = Math.toRadians(centre.latitude ); double lon = Math.toRadians(centre.longitude); // y double latPoint = lat + (radius / EARTH_RADIUS) * Math.sin(Math.toRadians(heading)); // x double lonPoint =

Automatically change map key based on debug or release version

元气小坏坏 提交于 2019-12-12 01:23:13
问题 Sometimes I forget to change over from my debug Google map key when I compile my app. Is there a way to have it change automatically so that I don't have to manually change it in the manifest everytime and possibly forget to change it for the release build again? 回答1: The best thing you can do it not to have to change it at all. First of all, you can check in the API_KEY into your repository even if it is public. Nobody can use the key without having your debug or release keystore (and

Configuring google maps in Android app

僤鯓⒐⒋嵵緔 提交于 2019-12-11 22:59:51
问题 I am trying to configure google maps API v2 in my app. For some reason, I am not able to configure it. I followed all the instruction step by step and the manifest file is as per the requirement. When I try to launch google maps, I see a blank screem The exception is below 11-14 05:19:51.948: E/Parcel(850): Class not found when unmarshalling: com.google.android.gms.maps.model.LatLng 11-14 05:19:51.948: E/Parcel(850): java.lang.ClassNotFoundException: com.google.android.gms.maps.model.LatLng

get location address w.r.t the polygon I am in

ⅰ亾dé卋堺 提交于 2019-12-11 22:30:36
问题 I have over 200 polygons to create and I get the location by LocationListenerOnChanged() but I would like to know which polygon I am in based on the current location . How will I use LatLng to check within within each polygon every 2 miles.And how can I make the entire process faster or will android os has inbuilt function. I checked a lot of documents related android maps v2 but I did not get any info about it.I appreciate any help w.r.t the topic .Thanks in advance. 回答1: There is no direct

Adding Google-play-services crashes aapt.exe

与世无争的帅哥 提交于 2019-12-11 20:40:12
问题 I'm trying to use google maps v2 for android by adding the google-play-services to my app as a library. Everytime I set a reference to the library I get windows dialog with the message that aapt.exe has crashed. And after I've set a reference to the library all my source files get errors. R.java in my gen folder gets deleted. Console is giving this message [google-play-services_lib] R.java was modified manually! Reverting to generated version! After deleting the reference to the google-play

Android: change marker's size/color based on parameter

南楼画角 提交于 2019-12-11 19:22:05
问题 Currently I'm using google-map-API V2 for android google map,is there any way I can based on one variable parameter change the marker(pin) size/color of google map? 回答1: float valueBetween0and360 = 222.222; marker.setIcon(BitmapDescriptorFactory.defaultMarker(valueBetween0and360)); will change marker icon color. For size you will have to provide your own icons and use BitmapDescriptorFactory.fromResource. 来源: https://stackoverflow.com/questions/18822504/android-change-markers-size-color-based

error inflating class fragment Google Maps v2

房东的猫 提交于 2019-12-11 19:16:25
问题 I've spent 24 hours trying to deploy a simple google maps v2 android apps. I've searched in a lot of forums (included stackoverflow)... but I'm desperated. The error is: android.view.InflateException: Binary XML file line #7: Error inflating class fragment Here is the activity_main.xml <?xml version="1.0" encoding="utf-8" ?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class=

Overrinding draw() in customized MapView in Google Maps Android API v2

风格不统一 提交于 2019-12-11 18:18:44
问题 Very simple question : since MapView inherits from View , is it possible to override draw() to draw whatever you want on the map ? 回答1: No, but you can use polylines, polygons, circles. If that's not enough you can put any bitmap (even one you draw to using Canvas) combined with ground overlay. If that's not enough, you can also use tile overlay to draw on entire map efficiently. It's all there in the documentation, I encourage you to study. Drawing directly can be always done on a view that

Get Map view instance from a Fragment

久未见 提交于 2019-12-11 16:47:12
问题 I have a MainFragment that consist of two fragments, a MapFragment and a ListFragment and this is its layout: MainFragment Layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:map="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <RelativeLayout android:layout_width="match

Make polygons perpendicular to bearing in google maps android

三世轮回 提交于 2019-12-11 14:57:03
问题 I'm creating polygons on a map getMap().addPolygon( getPolygonOptions(point1, point2, widthInMeters) .fillColor(Color.YELLOW)); The position of the corners is calculated by: public static PolygonOptions getPolygonOptions(LatLng point1, LatLng point2, double widthInMeters) { double distance = SphericalUtil.computeDistanceBetween(point1, point2) + 6; float bearing = location.getBearing(); double bears = bearing; LatLng corner1 = SphericalUtil.computeOffset(point2, widthInMeters / 2, bears + 90)