In high-res devices, the Callout in MapView flashes (hide and show) when tapping on the device screen, which affects user experience a lot.
From analysis, the com.esri.android.map.MapOnTouchListner calls Callout.hide( ) in a number of events (e.g. onDoubleTapDrag). My design is to do an identify task on the MapView when user long tap on the screen and display the result in Callout. But with such an existing issue, the result is very frustrating.
Do any other developers faced this issue as well?
Solved! Go to Solution.
Hey Mike C,
I was able to reproduce this on a Nexus 5x. I went ahead and logged the following defect:
BUG-000097661 : Callouts are flickering in the Android SDK when they are moved to a new location.
If possible could you record a video of this behavior and post it here?
Hello Mike C,
I am trying to reproduce this issue and I am having trouble.
This is the code I am using to display the callout:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myText = new TextView(getApplicationContext()); myText.setText("TEST"); mapView = (MapView) findViewById(R.id.map); mapView.setOnLongPressListener(new OnLongPressListener() { @Override public boolean onLongPress(float v, float v1) { Log.e("NOHE", "TEST"); Log.e("NOHE", "" + v + " " + v1); mapView.getCallout().setContent(myText); Point mapPoint = mapView.toMapPoint(v,v1); mapView.getCallout().show(mapPoint); return false; } }); }
Are you doing something similar or different?
Thanks,
Alexander
Hi Mike C,
I read a little more into what you are doing and also tried reproducing this way without success:
public class MapEventsBrian extends MapOnTouchListener { MapView mMapView; Context mContext; TextView myText; Point mapPoint; public MapEventsBrian(Context context, MapView view) { super(context, view); mContext = context; this.mMapView = view; myText = new TextView(context); myText.setText("TEST"); } @Override public void onLongPress(MotionEvent point) { super.onLongPress(point); float v = point.getX(); float v1 = point.getY(); Log.e("NOHE", "TEST"); Log.e("NOHE", "" + v + " " + v1); mMapView.getCallout().setContent(myText); mapPoint = mMapView.toMapPoint(v,v1); mMapView.getCallout().show(mapPoint); } @Override public boolean onLongPressUp(MotionEvent point) { mMapView.getCallout().hide(); return true; } }
and this was my implementation:
public class MainActivity extends AppCompatActivity { MapView mapView; TextView myText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mapView = (MapView) findViewById(R.id.map); MapEventsBrian mapB = new MapEventsBrian(getApplicationContext(), mapView); mapView.setOnTouchListener(mapB); } }
Hi Alexander,
We'd did a bit more to get into the problem.
When the LongPress event is triggered, we make an async call to get some results from web services, and show the callout when the result is arrived.
OR when we do a view.postDelayed() and show the callout in Runnable.run(), similar case will occurred:
// inside onLongPress(x, y)
final Point pt = mapView.toMapPoint(x, y);
mapView.postDelayed(new Runnable() {
@Override
public void run() {
Callout callout = mapView.getCallout();
// ... customized the callout,
callout.show(pt, view);
}
});
And I encountered this issue on Sony Xperia Z3 and Z3 compact at the moment.
Hey Mike C,
I was able to reproduce this on a Nexus 5x. I went ahead and logged the following defect:
BUG-000097661 : Callouts are flickering in the Android SDK when they are moved to a new location.