android-maps

Android Google Map Polygon click event [duplicate]

六月ゝ 毕业季﹏ 提交于 2019-12-10 21:35:47
问题 This question already has answers here : Polygon Touch detection Google Map API V2 (6 answers) Closed 3 years ago . I am working on a map application on Android and i am using Google Maps Android API V2. I get the polygon data from a web service, convert it by XML parse and can show it on the map without a problem. But isn't there any way to open like pop-up when user touches on any polygon? Or maybe if user wants to change coordinates of selected polygon. I saw many examples, but they are

Check if a GPS Lat/Lng point lies on a road in Google maps

帅比萌擦擦* 提交于 2019-12-10 18:23:58
问题 I'm developing a navigation app in android. I want to prompt the user when he goes off-road. So, if I have a GPS Lat/Lng point, is it possible to determine if that point lies on a road or not? Is there any API support for such checks? This is to be done on all roads in general and not while having a specified path/polyline. 回答1: You can use the isLocationOnPath() function for that. You have to add the dependency dependencies { compile 'com.google.maps.android:android-maps-utils:0.4+' } in

Exception when using MapView - java.lang.RuntimeException: stub

て烟熏妆下的殇ゞ 提交于 2019-12-10 15:46:17
问题 Does the following exception make sense to you? I'm struggling to identify the cause. It occurs when I open a an activity (ActivityMap) subclassed from MapActivity, even if the MapActivity's layout doesn't contain a mapview element. I suspect it's a project issue. I'm using IntelliJ IDEA. I've set the project up to build against the level 8 Maps API. The IDE is not highlighting any issues with my use of MapActivity in the source, and it builds without error - but then this exception at

NullpointerException when calling getSystemService(Context.LOCATION_SERVICE) and onLocationChanged not called

房东的猫 提交于 2019-12-10 14:21:39
问题 I am trying to create a background service that updates the current gps position. I am getting a NullPointerException at line LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); HomeActivity launches a service startService(new Intent(getApplicationContext(), ForHire.class)); Service (ForHire) creates a TimerTask Updates public class ForHire extends Service { ... private Timer getUpdatesNow = new Timer(); private Updates updates = new Updates(getUpdatesNow);

GestureDetector Deprecated Issue

血红的双手。 提交于 2019-12-10 12:28:23
问题 I have this code itemizedOverlay = new MyItemizedOverlay(drawable,this); itemizedOverlay.setGestureDetector(new GestureDetector(new MyGestureDetecor())); but new GestureDetector is marked as Deprecated in Eclipse. I want to avoid the use of deprecated methods. How could I fix this problem? What is the non-deprecated form? 回答1: Choose one of the other constructors. There are five defined constructors on GestureDetector. Two -- the ones not including a Context as the first parameter -- are

Android Google Map coordinate

半世苍凉 提交于 2019-12-10 11:58:49
问题 Currently doing a simple app that contain google map. and i would like to link to next activity when the user click on a designed coordinate but it is not working and there is no error, please help me double latitude = 1.34503109; double longitude = 103.94008398; LatLng latLng = new LatLng(latitude, longitude); gMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { @Override public void onMapClick(LatLng latLng) { Intent i = new Intent(Activity_Selecting_Bus.this, Activity_Bus

Android doubletap, ontouchevent is not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 11:40:29
问题 I need to zoom when double tapping. Why doesn't this work? I worked on it for long time which has no result. No touch event is recognized public class MyMapActivity extends MapActivity implements OnGestureListener{ private MapView mapView; @Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.main); mapView = (MapView)findViewById(R.id.mapView); mGestureDetector = new

android google map marker placing

穿精又带淫゛_ 提交于 2019-12-09 16:23:57
问题 In my Android application I need to place marker at exact position on map. I pin a marker on map with 51.507351, -0.127758 (London) location. I used the following code to do the work. googleMap.addMarker(new MarkerOptions().position( new LatLng(51.507351, -0.127758)).icon( BitmapDescriptorFactory.fromBitmap(BitmapFactory .decodeResource(getResources(), R.drawable.q_icon)))); googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(51.507351, -0.127758), 20)); And this my marker

Google Maps Android API v2 - MarkerOptions draggable and visible methods

霸气de小男生 提交于 2019-12-09 12:55:21
问题 I'm playing with the new Google Maps Android API (v2) released earlier this month and I was delighted to see a MarkerOptions.draggable(boolean draggable) method which I thought would create a draggable marker when passing in a draggable value of true . However, on trying it (i.e. adding a marker as such to the map), it doesn't seem to do anything. The MarkerOptions.visible(boolean visible) method too, which I thought would hide the marker from view when passing in a visible value of false .

New gms.maps.MapView rendering lags a bit when in a ListView?

我的未来我决定 提交于 2019-12-09 05:58:05
问题 I'm trying to put an instance of the new MapView in a ListView. New mapview being: com.google.android.gms.maps.MapView I'm turning all interactions off, and setting a fixed height for the view: GoogleMapOptions options = new GoogleMapOptions(); options.mapType(GoogleMap.MAP_TYPE_NORMAL); options.compassEnabled(false); options.rotateGesturesEnabled(false); options.scrollGesturesEnabled(false); options.tiltGesturesEnabled(false); options.zoomControlsEnabled(false); options.zoomGesturesEnabled