Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable magnifying glass in GoogleMaps, Android

I'm developing an application in Android and I show a location using latitude and longitude from GoogleMaps.

I have implemented the maps following this code: https://gist.github.com/joshdholtz/4522551

When I implement this I get the screen of my phone as shown:

phone screen

I dont know exactly what is that magnifying glass on the left of my map and I want to remove it.

I have disabled most of the UIsetting from the map.

map = googleMap;
    map.getUiSettings().setMyLocationButtonEnabled(false);
    map.getUiSettings().setMapToolbarEnabled(false);
    map.getUiSettings().setZoomControlsEnabled(false);
    map.getUiSettings().setAllGesturesEnabled(false);
    map.getUiSettings().setCompassEnabled(false);
    map.getUiSettings().setIndoorLevelPickerEnabled(false);
    map.getUiSettings().setZoomControlsEnabled(false);

And when I click on the magnifying glass im getting an exception:

 Process: com.itcom202.weroom, PID: 29587
java.lang.NullPointerException: Place Fields must be set.
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:889)
    at com.google.android.libraries.places.internal.dt.onClick(Unknown Source:4)
    at android.view.View.performClick(View.java:6256)
    at android.view.View$PerformClick.run(View.java:24701)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Can someone tell me how exactly the magnifying glass should be working and how to disable it? I want to allow the user to only scroll and zoom in the GoogleMaps fragment.

This is the google map fragment xml:

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.gms.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>
like image 743
Demi Dimitrova Avatar asked Nov 19 '25 02:11

Demi Dimitrova


1 Answers

You can call this method from onMapReady(GoogleMap googleMap)

googleMap.getUiSettings().setZoomGesturesEnabled(false);

Keep Codeing :)

like image 144
Ashok Reddy M Avatar answered Nov 22 '25 03:11

Ashok Reddy M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!