android-maps-v2

Error when try to add Google Maps

久未见 提交于 2019-12-06 14:08:09
问题 Couple moths ago i testing this app on Android N and all will work correctly, but now i have error. Now i'am using MapFragment and have this error: 05-09 23:22:35.816 11112-11112/pc.dd.sex_startup E/AndroidRuntime: FATAL EXCEPTION: main Process: pc.dd.sex_startup, PID: 11112 java.lang.RuntimeException: Unable to start activity ComponentInfo{pc.dd.sex_startup/pc.dd.sex_startup.LogIn.Maps.Map}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating

Google Maps Android API v2: GooglePlayServicesNotAvailableException not thrown anymore

て烟熏妆下的殇ゞ 提交于 2019-12-06 12:54:29
After updating Google Play Services to version 18, seems that GooglePlayServicesNotAvailableException can't be used anymore. This piece of code: try { MapsInitializer.initialize(ctx); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } generates this error: Unreachable catch block for GooglePlayServicesNotAvailableException. This exception is never thrown from the try statement body How can I achieve the same result now? Thanks Now the function initialize() returns a ConnectionResult so you can do something like this: if (MapsInitializer.initialize(ctx) !=

Google Map api 2 how to show/hide GoogleMap?

人盡茶涼 提交于 2019-12-06 11:20:19
问题 i want to show/hide googleMap. GoogleMap googleMap = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map2)).getMap(); how to set setVisibility(View.INVISIBLE) OR setVisibility(View.VISIBLE) ?? 回答1: you should hide the Fragment itself, or you can try with getView().setVisibility(View.INVISIBLE) inside the SupportMapFragment subclass. From your Activity: FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction() ft.hide(mFragment)

MapView v2 snapshot() creates an unfinished Bitmap

帅比萌擦擦* 提交于 2019-12-06 09:06:12
I'm using the new snapshot() method on the GoogleMap object, and in my SnapshotReadyCallback I'm swapping out the MapView in my layout for an ImageView with the Bitmap passed to me from the callback. The unfortunate thing about this is, even though I'm getting a Bitmap it appears that the snapshot was taken before the map finished rendering. I should also add that this View is being created programmatically, and isn't added to the Activity right away (it's actually being placed in a ScrollView with a bunch of other Views). The gist of my code (for brevity's sake) is: public class MyCustomView

Event for marker position change

耗尽温柔 提交于 2019-12-06 08:51:25
问题 I'm using the new Google Maps for Android v2. Is there a way to set a listener for marker position change? For example when the user drag the marker. 回答1: Quoting the documentation: You can use an OnMarkerDragListener to listen for drag events on a marker. To set this listener on the map, call GoogleMap.setOnMarkerDragListener. To drag a marker, a user must long press on the marker. When the user takes their finger off the screen, the marker will stay in that position. When a marker is

How to get the location of centered place pin on Map like uber android app

╄→гoц情女王★ 提交于 2019-12-06 08:17:10
问题 Someone please explain me how to get the location of centered place pin on Google Map Like in this Uber App. User can move the map but pin is always centered align and We can get the location as we keep moving the map. 回答1: You can use CurrentCenterPositionMap First import the lib: compile 'br.com.simplepass:mapfragmentwrapper:0.8.0' Then, all you have to do is to put the MapFragmentWrapper xml tag as a container of your map fragment. Like this: <br.com.simplepass.mapfragmentwrapper

Add Google Maps to Android app

旧时模样 提交于 2019-12-06 04:41:49
I need help adding Google Maps to my Android app. I have followed the instructions on https://developers.google.com/maps/documentation/android/start , but I still get an error when running the app. This my manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.image.app" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".map" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation"> <intent

How to draw a shape dynamically on map touched location in android

你说的曾经没有我的故事 提交于 2019-12-05 18:29:04
I want to draw a shape, wherever the user touches the map, the should be drawn dynamically. I don't have any idea about drawing these shapes. How could I achieve this? Can I get this done through canvas? I am using MapFragment. Please see the image, Please give me any idea!! Any help is appreciated!! You can do that by adding a View overlaying the map. have a Polyline object (initially empty) that will be your line handle onTouchEvent on that View translate x,y from events to LatLng using Projection add new point to Polyline And you are done. Note that this consumes all the events that would

Maps v2 marker animation - fade in and out

十年热恋 提交于 2019-12-05 12:30:40
How would one fade in and out a GoogleMap marker ? This is how I add a marker to the Map: marker = map.addMarker(new MarkerOptions() .position(point) .title(title) .snippet(text) .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)) ); MaciejGórski With Google Play services 4.0+ you can use Marker.setAlpha in conjunction with Handler that posts some Runnable every few milliseconds. The code will be similar to my answer here Drop marker slowly from top of screen to location on android map V2 . Just setAlpha instead of setPosition and you are on your way home. A much simpler and cleaner

Animate marker on Polyline path

故事扮演 提交于 2019-12-05 07:09:25
I have 3 markers on a Google Map. Two Markers to show starting and ending points Here is the code using to draw a Polyline between these two points: private void polyLine() { LatLng starting = new LatLng(##.######, ##.######); LatLng ending = new LatLng(##.######, ##.######); PolylineOptions line = new PolylineOptions().add(starting, ending); mGoogleMap.addMarker(new MarkerOptions().position(starting).title("Start")); mGoogleMap.addMarker(new MarkerOptions().position(ending).title("End")); mGoogleMap.addPolyline(line); } One Marker to show current Location [HUE_ROSE] And to animate marker to