google-maps-android-api-2

How to check if an Google Maps InfoWindow is still displayed before updating it?

我的梦境 提交于 2019-12-03 00:32:13
I started working on an InfoWindowAdapter that is displaying location images inside the InfoWindow. I have a lot of different locations, therefore it is possible that an location image is not available on the phone and is downloaded from the web. Now the Maps API states the following: Note that a snapshot of the returned view will be taken and then rendered on the map so subsequent changes to the view will not be reflected by the info window on the map. To update the info window (e.g., after an image has loaded), just call showInfoWindow() and the view will be updated. As I understand this I

Get my location

五迷三道 提交于 2019-12-02 23:40:54
问题 I have a ListFragment and I want to get the my location. In my Manifest I have added this: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> and my ListFragment´s code is here, but not works: public class ListaLugaresFragment extends ListFragment implements LocationListener { GoogleMap googleMap; Location location; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { v= inflater.inflate(R.layout.lista, container

Handling touch events in SurfaceView over Maps API v2

耗尽温柔 提交于 2019-12-02 23:37:49
I'm having issues in creating event handler that will be triggered while user moves the map around. There is a OnCameraChangeListener , but it is triggered after map moving stops. I have created SurfaceView over Maps, and now I have no idea how to handle onScroll event from OnGestureListener . Here is the sample code: SurfaceView sv = new SView(); sv.setZOrderOnTop(true); mapView.addView(sv); ... public class SView extends SurfaceView implements Runnable, android.view.GestureDetector.OnGestureListener { ... @Override public boolean onTouchEvent(MotionEvent event) { //this worked in Overlay in

Adding a button to a custom InfoWindowAdapter view that can register clicks

不打扰是莪最后的温柔 提交于 2019-12-02 22:41:40
I'm adding an InfoWindowAdapter with a custom layout to the Android Google Maps API v2 based map fragment. I've put a button in the view I return from getInfoWindow() and while it shows up perfectly fine, when I click on said button the window itself registers a click (blinking with a yellowish tint as usual) while the button does not. How can I make a button in the info window "clickable"? And, by extension, any view inside an info window? Instead, listen for marker click events with OnMarkerClickListener and display your own complete view directly. It may be a bit more work to anchor it to

“Google Play services are updating” error on release, not emulator (Google Play Services 12.6.73, Huawei devices)

余生长醉 提交于 2019-12-02 21:56:49
I'm facing the same issue as in Stack Overflow question "Google Play services are updating" in Google Maps API . Unfortunately, out of nowhere, some of my users are suffering this issue, as well as my own phone. On the other hand, for other users it seems to work perfectly fine. This issue appears only on maps in my app. I've tried to clean Google Services's cache on my own phone - still nothing. On my emulator it works fine. I've searched all over the Internet and haven't managed to find a working solution for this. The most important part is this: Most of the solutions that I've found were

Centering bitmap Marker (Google Maps Android API v2)

别来无恙 提交于 2019-12-02 18:42:00
When I add a marker from a custom Bitmap, the marker is not centered at the point I specify. I'm adding it like this: // ID tramo final int tramoId = tr.getId(); // Nodos final Nodo[] nodos = tr.getNodos(); final PolylineOptions p = new PolylineOptions(); MarkerOptions m = new MarkerOptions(); // Seteamos posicion de linea y marker m.position(semisuma(nodos)); for (final Nodo n : nodos) { p.add(n.getLatLng()); } // Color de linea y marker BitmapDescriptor icon = null; if (tr.getCapacidad() == 0) { p.color(0xFF000000); m = null; } else if (tr.getCapacidad() - tr.getPlazasOcupadas() == 0) { p

How to add custom controls to MapFragment in Google Maps Android API v2?

≡放荡痞女 提交于 2019-12-02 18:26:24
I have SupportMapFragment and I need to add custom controls into it for changing a map type. Calling getView(), I get NoSaveStateFramelayout and I don't think it is a good idea to add it directly into it or its children. What is the best way how can I can add a button over my map for changing the map type? I have decided to override onCreateView and encapsulate the map in the code. @Override public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) { View mapView = super.onCreateView(inflater, viewGroup, bundle); RelativeLayout view = new RelativeLayout(getActivity(

Adding custom property to marker (Google Map Android API V2)

泄露秘密 提交于 2019-12-02 17:38:51
When using Google Map API V3 I can add custom property in the following way: var marker = new google.maps.Marker({ position: userLocation, map: myGoogleMap, animation: google.maps.Animation.DROP, icon: avatar, title: userName, customProperty1: bla, customProperty2: bla, customProperty3: bla, ... }); I'm wondering if I can do the same for API V2 Android, the reason I want to do this is that each info window of each marker need to know some information of that marker. And I'm trying to achieve this in render function below: private void render(Marker marker, View view) { int badge = R.drawable

Open URL from custom info window, Android Google Maps V2

孤街醉人 提交于 2019-12-02 17:28:28
问题 I am using android google maps api v2 with many markers displayed on it. Each time you click on a marker a custom info window with specific tittle/snippet is open. The problem is that I cannot click on the URL "www.news.com". Please find below the options of my marker. How can I specify that the "www.news.com" is a HTML URL link inside the .snippet attribute, and when user clicking on it to open directly in mobiles explorer? mMap.addMarker(new MarkerOptions() .position(new LatLng(39.686286,

This app won't run unless you update Google Play Services (via Bazaar)

穿精又带淫゛_ 提交于 2019-12-02 16:21:41
问题 I'm testing out the new Google Maps API V2 for Android, and I'm getting this message when the app launches: This is running on an 4.1 emulator. Here is my AndroidManifest.xml file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.maptest" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <permission android:name="com.example.maptest.permission.MAPS_RECEIVE" android:protectionLevel=