android-maps-v2

Offseting the center of the MapFragment for an animation moving both the target lat/lng and the zoom level

随声附和 提交于 2019-11-27 00:05:54
问题 I've got a UI that has a MapFragment with a transparent View overlaid on top of it. The map takes up the entire screen, whereas the View is just the left third of the screen. As a result, the default "center" of the map is off. When someone clicks on a marker, I want to center that marker in the wholly visible area of the MapFragment (not the center of the MapFragment itself). Since this is hard to describe with words, let me use a few pictures. Suppose this is how my UI looks: When the user

How to attach a flexible marker on map something like Uber and Lyft?

扶醉桌前 提交于 2019-11-26 23:22:41
问题 How to attach a flexible marker on map something like Uber and Lyft ? am using Google maps v2. Basically, i want to display a marker on map while the position of the marker is changed upon moving the map. edited: Ok i solved my problem. first : add an imageview to the same layout and position equal to center. second: to get the coordinate of the center of the map use the following approach 1- get viewgroup ( FrameLayout ) in my case where the map fragment is located. FrameLayout myContainer =

Android Map V2 - Why MAPS_RECEIVE permission

北战南征 提交于 2019-11-26 23:20:02
问题 Consider this as a wiki question. While I setup my project to support Map V2, There has been a step to add MAPS_RECEIVE permission. <permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/> Why we creating and consuming the permission from the app itself? Is that google play services app interact using this permission ? This permission can't takes care of these

Change marker size in Google Maps API v2

时光总嘲笑我的痴心妄想 提交于 2019-11-26 22:56:13
问题 I'm trying to port my app to the brand new Google Maps API v2, but can't find how to change the size of the marker (some of my markers are smaller than default). In v1, I used a Drawable which I scaled with setBounds() before adding it to the map. But now, in v2, I can't use a Drawable . I've to use MarkerOptions().icon() , which takes just a BitmapDescriptor (generated with a BitmapDescriptorFactory ). Looking at the reference, there doesn't seem to be any support for setting or changing the

Moving MapFragment (SurfaceView) causes black background flickering

左心房为你撑大大i 提交于 2019-11-26 22:32:22
问题 I'm trying to implement new Android Google Maps API (v2). However it doesn't seem to go well with SlidingMenu. As you may know, MapFragment implementation is based on SurfaceView . The problem is that the SurfaceView doesn't like moving it around - I mean placing it in movable views: ViewPager, ScrollView, ListView, or the aforementioned SlidingMenu . When you move it, it leaves a black hole in the place where its pixels originally layed. It looks something like this. This problem can be

Android Maps v2 rotate mapView with compass

偶尔善良 提交于 2019-11-26 20:58:30
问题 I'm developing an app which needs to rotate the mapView with a compass. I know how to rotate the camera but I need to rotate the mapView with the compass. the center point should be the current location. I found codes for Maps V1 but I need to do it with Maps V2 回答1: OK, i figured it out myself. first you need to calculate the bearing from the compass. then the Maps api-2 camera can be rotated. public void updateCamera(float bearing) { CameraPosition currentPlace = new CameraPosition.Builder(

what makes my map fragment loading slow?

夙愿已清 提交于 2019-11-26 19:08:50
问题 Performance Enhancement: Previously I saved ALL images in drawable folder, this might be the reason why the map first loads slow, when draw the markers on screen, the image may not fit the screen size. Now I saved images in drawable-mdpi , drawable-hdpi and so on, the app works smoother than before. Hope it helps Original Question: I created a map in a fragment, the source code can be found below. The map fragment is sluggish when the first time it loads. If I go any other fragment and click

Move all the markers on the map to their updated/new current location periodically as users moves

筅森魡賤 提交于 2019-11-26 18:38:22
问题 I'm developing an android app where some users opens the same activity from their devices. There is a map in this activity and as users opens this activity from their devices, their location coordinates is fetched from Firebase and a marker based on these coordinates is shown on the map. Here's my code: acceptingUserReference.child(requestID).child(key).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot

Android: Build Polygonal Shape Geofence

妖精的绣舞 提交于 2019-11-26 18:29:29
问题 According to the API documentation, only Circular shape Geofences allowed: https://developers.google.com/android/reference/com/google/android/gms/location/Geofence.Builder And it's looks for example: https://developer.android.com/training/location/geofencing.html But I have 4 locations, representing 4 corners of rectangle, and I want my Geofence to be that rectangle. I want to avoid solution of building my custom location monitoring service extending the functionality of monitoring Geofences,

Identify if point is in the polygon

半城伤御伤魂 提交于 2019-11-26 16:34:28
问题 As per my requirement, I am drawing polygons on google map shown in the image below.(using maps v2) Now I need to show an alert when user enters that particular polygons. How to identify if my current location is with in the polygon. (Need optimized way without draining battery) Thanks in advance. 回答1: Just tried Ray Casting algorithm which identifies point in polygon. This works perfect. Refer http://en.wikipedia.org/wiki/Point_in_polygon for thesis of Ray-Casting private boolean