I have to restart my Esri map or restart app to show map callout but the map callout is actually present in the desired location but never displays in the first launch of the app. Here is my code.
mMapView = findViewById(R.id.map); //ArcGISMap map = new ArcGISMap(SpatialReference.create(2868)); ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector());mMapView.setMap(map); //new Handler().postDelayed(()->mMapView.setMap(map), 3000); mMapView.getGraphicsOverlays().add(graphicsOverlay);PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol((BitmapDrawable)getResources().getDrawable(R.mipmap.pin_blue));Graphic graphic = new Graphic(point, attr,pictureMarkerSymbol);Map<String, Object> attr = new HashMap<>(); attr.put("position", i);attr.put("name", record.getName());
graphicsOverlay.getGraphics().add(graphic);
Hi Ahsan,
I don't see Callout being used in the above code snippet. Is there additional code that you can share that might help us reproduce the problem?
Here you go.
private void displayPopup(Graphic graphic) { Callout mapCallout = mMapView.getCallout(); Map<String, Object> atts = graphic.getAttributes(); String customId = (String) atts.get("customid"); String name = (String) atts.get("name"); String address = (String) atts.get("address"); String date = (String) atts.get("date"); String lotNumber = (String) atts.get("lotnumber"); String inspectiontype = (String) atts.get("inspectiontype"); /*if(lotNumber==null || lotNumber.equals("")) lotNumber= "-";*/ View convertView = getLayoutInflater().inflate(R.layout.map_infowindow, null); TextView textViewRecordCustomID = convertView.findViewById(R.id.textViewRecordCustomID); TextView textViewName = convertView.findViewById(R.id.textViewName); TextView textViewDate = convertView.findViewById(R.id.textViewDate); TextView textViewAddress = convertView.findViewById(R.id.textViewAddress); TextView textViewInspectionType = convertView.findViewById(R.id.textViewInspectionType); TextView textViewLotNumber = convertView.findViewById(R.id.textViewLotNumber); textViewDate.setVisibility(View.GONE); textViewName.setVisibility(View.GONE); textViewRecordCustomID.setText(""); textViewName.setText(""); textViewDate.setText(""); textViewAddress.setText(""); textViewInspectionType.setText(""); textViewLotNumber.setText(""); textViewRecordCustomID.setText(""); textViewRecordCustomID.setText(""); //TextView textViewLastInspectionDate = (TextView)convertView.findViewById(R.id.textViewLastInspectionDate); textViewRecordCustomID.setText(customId); textViewName.setText(name); textViewDate.setText(date); textViewAddress.setText(address); textViewInspectionType.setText(inspectiontype); textViewLotNumber.setText("Lot Number:" + lotNumber); convertView.setTag(R.string.id_position, atts.get("position")); convertView.setOnClickListener(v -> openDetail((int) v.getTag(R.string.id_position), true)); // Here, we populate the Callout with the attribute information // from the report. //mapCallout.off(0, 0); mapCallout.setLocation(selectedPoint); mapCallout.setShowOptions(new Callout.ShowOptions(true, true, true)); //mapCallout.setMaxWidth(1000); //mapCallout.setMaxHeight(400); mapCallout.setStyle(new Callout.Style(this, R.xml.mycalloutprefs)); mapCallout.setContent(convertView); Geometry graphicGeom = graphic.getGeometry(); if (graphicGeom instanceof Point) { mapCallout.show(convertView, (Point) graphicGeom); } else { int selectedX = 1; int selectedY = 1; mapCallout.show(convertView, mMapView.screenToLocation(new android.graphics.Point(selectedX, selectedY))); } //mapCallout.show(); }
I'm having the exact same issue but only when I create a local geodatabase, when I load it the callout shows. Have you managed to find a solution?
Thank you
No, I am still unable to identify that what is the difference between the first and the other runs. I think I am not using any local geodatabase because every time I have to fetch the layers from a url. Please let me know if you have any leads.
Thanks.
Hello team Esri, have you come to any conclusion regarding this issue? It has been 5 months now.
Thanks.
Hello team Esri
I reproduce the problem. After callout.show(), the callout.isShowing() is true.
I've checked with the Layout Inspector and I've seen a difference between order the order of view inside MapView
At the first boot after install:
Then after restarting the application, callout.show() display the box :
I met the same problem. Does anyone have the solution?
This solution I have tested. and Its working. only trick is, you have to set
callout.style=Callout.Style(context,resourceId)
, whenever your are calling
callout.show()
val calloutContent = layoutInflater.inflate(R.layout.callout_map, root, false)val mCallout = mapView.calloutmCallout.style = Callout.Style(this, R.xml.callout_style)mCallout.location = pointmCallout.content = calloutContentmCallout.show()
Thanks for the reply Dastan, I already had this style property set in my code but maybe if you can share me the preferences you are using in that xml then that may become helpful.