mylocationoverlay

How to draw at the current GPS location on MapView using MyLocationOverlay?

[亡魂溺海] 提交于 2019-12-19 04:57:22
问题 I'm trying to draw a custom gps-location icon. I'm using MapView and have created a class MyLocationArrow that extends MyLocationOverlay. I override drawMyLocation() and draw a point at 100,100. But this is the coordinates on screen. How do I get the screen-coordinates from the current GPS-location? 回答1: You can use android.graphics.Point toPixels(GeoPoint in, android.graphics.Point out) Converts the given GeoPoint to onscreen pixel coordinates, relative to the top-left of the MapView that

How can I use a custom bitmap for the “you are here” point in a MyLocationOverlay?

ぃ、小莉子 提交于 2019-12-17 10:57:16
问题 I've poured over the docs and haven't been able to figure this out. Is it even possible? Please see this 回答1: It looks like the correct mechanism to do this is to extend MyLocationOverlay then override the drawMyLocation() protected method. The following uses an arrow to show where "you" are and which way "you" are pointing: package com.example; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android

Modifying mylocationoverlay Color in Android

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 05:17:14
问题 Is it possible to modify the color scheme of mylocationoverlay I want to conver the blinking dot into red color. Please guide me how can I make it possible. 回答1: See this related question for the answer - myLocationOverlay change the marker Basically, create a subclass of MyLocationOverlay then override drawMyLocation(). There is example code in the related answer. You can see the API here - http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MyLocationOverlay

Draw route by getting my point to destination point

爷,独闯天下 提交于 2019-12-06 15:14:03
问题 String uri = "http://maps.google.com/maps?saddr=" + src_lat+","+src_lon+"&daddr="+des_lat1+","+des_lon1; Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)); intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); startActivity(intent); Here is the code for drawing a route between two locations where both the source and destination's latitude and longitude are known. But here I want to replace my location's longitude and latitude

MyLocationOverlay or LocationManager for updating current location

为君一笑 提交于 2019-12-06 01:07:00
问题 I am using MapView to show current location of a user on a Map. To update the location while the user is on the move, I have to a choice: I can use MyLocationOverlay to draw the current location and extend it to allow tracking of the users location on the move and to have custom marker. The problem with MyLocationOverlay is that I cannot control the frequency with which the device requests the location from GPS. I am worried about the battery drain here. I can use Location Manager and

MyLocationOverlay disableMyLocation() not seeming to work

坚强是说给别人听的谎言 提交于 2019-12-05 01:00:37
问题 Just wasted 3 hours trying to figure out why the GPS icon is still showing up in the notification bar when my map activity is paused. I've narrowed it down to having to do with the MyLocationOverlay object I'm using (I also have a LocationListener and a GpsStatus.Listener). @Override protected void onPause() { super.onPause(); manager.removeUpdates(locListener); manager.removeGpsStatusListener(statListener); myLocOverlay.disableMyLocation(); //!doesn't seem to work myLocOverlay.disableCompass

Draw route by getting my point to destination point

孤街浪徒 提交于 2019-12-04 21:20:03
String uri = "http://maps.google.com/maps?saddr=" + src_lat+","+src_lon+"&daddr="+des_lat1+","+des_lon1; Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)); intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); startActivity(intent); Here is the code for drawing a route between two locations where both the source and destination's latitude and longitude are known. But here I want to replace my location's longitude and latitude to src_lon and src_lat , whose values I do not know and this longitude and latitude are changed with

MyLocationOverlay or LocationManager for updating current location

ⅰ亾dé卋堺 提交于 2019-12-04 05:20:37
I am using MapView to show current location of a user on a Map. To update the location while the user is on the move, I have to a choice: I can use MyLocationOverlay to draw the current location and extend it to allow tracking of the users location on the move and to have custom marker. The problem with MyLocationOverlay is that I cannot control the frequency with which the device requests the location from GPS. I am worried about the battery drain here. I can use Location Manager and subscribe using requestLocationUpdates to get location from GPS. Here I have more control over the frequency

MyLocationOverlay disableMyLocation() not seeming to work

我的未来我决定 提交于 2019-12-03 16:42:40
Just wasted 3 hours trying to figure out why the GPS icon is still showing up in the notification bar when my map activity is paused. I've narrowed it down to having to do with the MyLocationOverlay object I'm using (I also have a LocationListener and a GpsStatus.Listener). @Override protected void onPause() { super.onPause(); manager.removeUpdates(locListener); manager.removeGpsStatusListener(statListener); myLocOverlay.disableMyLocation(); //!doesn't seem to work myLocOverlay.disableCompass(); } If anyone has any idea why this is happening please help so I don't pull all my hair out. I can't

Maps V2 myLocation blue dot callback

China☆狼群 提交于 2019-12-01 12:58:12
I want to be able to click the blue dot (my location) that is shown on the map. Is there anyway to get a callback from that click? Thanks, Martijn One possible workaround might be drawing a Marker (with a similar icon) on top of the My Location dot so you can receive the corresponding onMarkerClick() callback. This would also require removing the marker and adding it to the new location everytime there's a location update event, which you can listen to by implementing OnMyLocationChangeListener . EDIT : the OnMyLocationChangeListener interface is now deprecated, one should use instead the new