android-maps-v2

How to make a marker appear or disappear based on zoom level on Google Maps v2

谁说胖子不能爱 提交于 2019-12-23 05:11:50
问题 We all know that some of the predefined landmarks on Google Maps does not appear on a lower zoom level, but on a higher zoom level, it suddenly appears. I would like to know If I can make a customized marker not appear at lower zoom levels, then appear at higher ones. EDIT: Here is a snippet of my code. // Changing marker icon marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.gasbig)); // adding marker map.addMarker(marker); //position on Center CameraPosition cameraPosition = new

How to place taken photo from camera intent and place in maps where users has tapped (point on map)

不羁岁月 提交于 2019-12-23 05:05:20
问题 I have asked a question about taking a photo and returning that image to the point on the map where the users has tapped. Previously the camera intent would crash got it now to work without crashing the app but have the problem now of placing the image back into the map. Here is my updated code: @Override public void onMapLongClick(LatLng point) { Intent getCameraImage = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File cameraFolder; if (android.os.Environment.getExternalStorageState().equals

GeoFence alert does not show

邮差的信 提交于 2019-12-23 04:26:22
问题 After adding a geofence using below code, Notification is not showing.Even onResult callback is returing the success. Adding geofence in GoogleApiClientApi onConnected() callback method: public void onConnected(Bundle bundle) { LocationServices.GeofencingApi.addGeofences( googleApiClient, getGeofencingRequest(), getGeofencePendingIntent() ).setResultCallback(this); } Requesting Geofence: private GeofencingRequest getGeofencingRequest() { geoFenceList.add(new Geofence.Builder() .setRequestId(

Serialize or save PolylineOptions in Android

半腔热情 提交于 2019-12-23 02:39:28
问题 In my Android app I am already saving some strings to the SharedPreferences and serializing an ArrayList with Strings so this data is saved and can be used for future purposes. Even when the app is closed. A minute ago I discovered that I need to save my PolylineOptions for future use as well. PolylineOptions contain some coordinates to draw a line on my map with a color and width. I discovered that PolylineOptions aren't serializeable like Strings. Is there a way to 'save' my PolylineOptions

Delayed panning after map in gallery was moved away by a dialog

自闭症网瘾萝莉.ら 提交于 2019-12-22 10:22:25
问题 I have a map in a gallery, together with other pages. When I am sliding the gallery pages with touch gestures everything works fine. But when I move the map away using a button on a dialog, and then slide back to the map, the map does no longer smoothely follow the panning gesture. It rather follows with a noticeable delay. As soon as I hide the map once again with a dialog and close the dialog, e.g. with the back button, the behaviour returns to normal. To reproduce it, I have stripped down

Android Maps v2 custom marker has incorrect position on zoom

…衆ロ難τιáo~ 提交于 2019-12-22 06:56:53
问题 I know this has been discussed before, but I actually can't find a solution. I am adding a custom icon for my marker: markerUserLocation = mMap.addMarker(new MarkerOptions().position(new LatLng(point.latitude, point.longitude)) .anchor(0.5f, 1.0f) .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_marker_my_location))); The problem is when zooming in/out the marker gets positioned in a bad place. I have tried to play with the anchor values, but no success. Isn't the default anchor mid

Google Maps v2 Error on use of setMyLocationEnabled

我是研究僧i 提交于 2019-12-21 22:04:15
问题 I am not sure were I went wrong, getting a nullPointerException on using googlemap.setMyLocationEnabled(true) in Google Map v2 example. MainActivity.java File: package com.example.locationgooglemapsv2; import java.io.IOException; import java.util.List; import android.content.Context; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location

Android MapView v2 Context Issues and Memory Leak

戏子无情 提交于 2019-12-21 21:29:03
问题 I'm using MapView v2 in my application (not MapFragment ) and it's causing a memory leak. The leak occurs when I pass the Activity context to the MapView constructor. If I pass the Application Context to the MapView constructor the memory leak goes away, however the MapView starts performing badly when I scroll the ScrollView it's in. Here's a snapshot of where the leak is happening: The relevant code in MapView is: public class MapView extends android.widget.FrameLayout { private final com

Generate random LatLng given device location and radius

半腔热情 提交于 2019-12-21 17:40:54
问题 I am trying to generate random points on the map near a given location. I have a circle shape which surrounds the user location with a radius of 100, and I would like to generate random LatLng coordinates within this circle area. I have come up with the following function so far, but the point markers are still appearing outside the circle range. double lat = location.getLatitude(); double lon = location.getLongitude(); for (int i = 0; i < markers.size(); i++) { Marker mrk = markers.get(i);

Can't receive LocationClient's location updates after screen gone off

自古美人都是妖i 提交于 2019-12-21 17:27:44
问题 I'm trying to write a simple Android Service that runs in background and receives location updates from LocationClient (Google Map API Android V2). The problem is that when the screen go off, my Service doesn't receives anymore location updates. I tried to check if the service was active, even with screen off, and it does (I have a TimerTask scheduling a log). When screen is on I can receive location updates, but when screen goes off I see only TimerTask's logs and I don't receive any