I am trying to create a nutiteq ViewLabel
with an custom view containing three Button
s.
My code and the problem are very similar to this post nutiteq: Button resp. clickable Views not working in Custom ViewLabel.
With the provided answer of the referred post I noticed that the onTouchEvent
-Method of the view is called and that the object which performs the click is posted by a handler to a runQueue which is triggered by the Choreographer.
After pressing a Button
in the ViewLabel
those internal calls I've described above happen, but the onClick
-Method of the Button
is not executed until I press somewhere outside the ViewLabel
. Then the ViewLabel
closes (like it should, when are pressing on the map behind it) and Toast
I put in the onClick
-Method is triggered.
I think the problem has something to do the UIThread
. Seems like the performClick
-Action is put into the wrong runQueue, which is active when the user doesn't have a Label
opened.
It would be nice if someone has an idea, how to solve that problem.
Edited: Here is how i build the ViewLabel. This method is in a class which is called by the MapActivity:
public void createViewMarker(View markerView, Bitmap icon, MapPos pos, Category cat, String tag) {
MarkerStyle markerStyle = MarkerStyle.builder().setBitmap(icon).setSize(0.5f).setColor(
Color.WHITE).build();
ViewLabel label = new ViewLabel(markerView, new Handler(Looper.getMainLooper()));
label.setTouchHandlingMode(true);
markers.add(new MocaMarker(pos, label, markerStyle, cat,
markerLayer, tag));
}