Here Map Premium plan Map.InfoBubbleAdapter() ,hideInfoBubble ,getInfoBubbleContents and isInfoBubbleVisible missing?

十年热恋 提交于 2019-12-04 06:53:09

问题


I am trying to show the custom layout when user clicks on the marker object. The basic pack code works properly .

However when i shifted to premium pack it does not have Map.InfoBubbleAdapter(),hideInfoBubble,getInfoBubbleContents and isInfoBubbleVisible.

I am not even able to open the infoBubble when user click on marker too.

This is the code for custom view in basic pack i used.

  hereMap.get(new Map.InfoBubbleAdapter() {
                                @Override
                                public View getInfoBubbleContents(MapMarker mapMarker2) {
                                   return null;
                                }

                               @Override
                                public View getInfoBubble(MapMarker mapMarker2) {
                                    View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_marker_infowindow, null);
                                    TextView infoWindowText = view.findViewById(R.id.infoMessage);
                                    infoWindowText.setText(mapMarker2.getTitle());
                                   return view;
                                }
                           });

and this is the code that i was using on click of marker

  @Override
        public boolean onMapObjectsSelected(List<ViewObject> objects) {

            for (ViewObject object : objects) {
                if (object.getBaseType() == ViewObject.Type.USER_OBJECT && ((MapObject) object).getType() == MapObject.Type.MARKER) {
                    MapMarker mapMarker = (MapMarker) object;
                    System.out.println("Title is................." + mapMarker.getTitle());

                    if (!mapMarker.isInfoBubbleVisible()) {
                        mapMarker.getInfoBubbleContents();
                    } else {
                        mapMarker.hideInfoBubble();
                    }
                    return true;
                }
            }

How can i show the custom info bubble when user click on the marker?


回答1:


You should use sticky map overlays instead: https://developer.here.com/documentation/android-premium/api_reference_java/com/here/android/mpa/mapping/MapOverlay.html

Then add your MapOverlay implementation to the Map via Map.addMapOverlay: https://developer.here.com/documentation/android-premium/api_reference_java/com/here/android/mpa/mapping/Map.html#addMapOverlay-com.here.android.mpa.mapping.MapOverlay-

The idea behind is, that you can use a normal Views (very flexible, your own design, etc.) and stick it to a position on the map (and the map will keep it in place then). This gives you full flexibility on logic and design.



来源:https://stackoverflow.com/questions/53409090/here-map-premium-plan-map-infobubbleadapter-hideinfobubble-getinfobubblecont

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!