0

I want to configure my map using HERE FREE SDK so when i click on a marker a pop-up shows up with some Texts , i've tried InfoBubble but i think that's not working anymore, also i wanted to try MapOverlay but it seems that it's limited to JS only. so here's my code :

MapMarker myMapMarker =  new MapMarker(new GeoCoordinate(LAT, LNG), myImage);

map.addMapObject(myMapMarker);
MapGesture.OnGestureListener listener = new MapGesture.OnGestureListener.OnGestureListenerAdapter() {
    @Override
    public boolean onMapObjectsSelected(List<ViewObject> objects) {
        for (ViewObject viewObj : objects) {
            if (viewObj.getBaseType() == ViewObject.Type.USER_OBJECT) {
                if (((MapObject)viewObj).getType() == MapObject.Type.MARKER) {
                        map.setInfoBubbleAdapter( new Map.InfoBubbleAdapter() {
                        @Override
                        public View getInfoBubbleContents(MapMarker mapMarker) {
                            return null;
                        }

                        @Override
                        public View getInfoBubble(MapMarker mapMarker) {
                            View Bubble;

                            Bubble =LayoutInflater.from(getActivity()).inflate(R.layout.bubble_layout,       container, false);
                            TextView nom = Bubble.findViewById( R.id.nomecole );
                            nom.setText( "School" );
                            return Bubble;
                        }
                    } );
                    ((MapObject)viewObj).setVisible(false);
                }
            }
        }

        return false;
    }
};

and for my bubble layout : `

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
    <TextView
        android:id="@+id/nomecole"
        android:layout_width="100dp"
        android:layout_height="30dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="-4dp"
        android:layout_marginTop="32dp"
        android:gravity="center"
        android:text="@string/nom"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="13sp" />
    </RelativeLayout>

`

Ayoub Beltarchi
  • 47
  • 2
  • 11

1 Answers1

0

You must call MapMarker.showInfoBubble() to show and MapMarker.hideInfoBubble() to hide info bubble.

Also you may need to remove the line that hides MapMarker so the marker stays visible after it was clicked. This line:

((MapObject)viewObj).setVisible(false);
NazarK
  • 1,221
  • 2
  • 14
  • 16
  • Hi, was it deleted or replaced with something else? I can find this neither in the doc nor in the API. – Witold Kupś Mar 01 '21 at 09:18
  • 1
    This API was deleted since then. As of now, you can use MapOverlay API to attach android's View to the geo coordinate on the map. – NazarK Mar 01 '21 at 09:21