Hi,
thanks you very much for your works,
i'm just a student who makes some research about your awesome application ^^
my problem is that i need to use the OnMapElementListener, but it seems that there is not function implemented yet.
by example :
OnMapElementListener toto=new OnMapElementListener() {
@Override
public void elementLeft(OnMapElement arg0) {
Log.d("test","test1 "+arg0.getLabel() );
}
@Override
public void elementEntered(OnMapElement arg0) {
Log.d("test","test2 "+arg0.getLabel() );
}
@Override
public void elementClicked(OnMapElement arg0) {
Log.d("test","test3 "+arg0.getLabel() );
}
}
in my case, it generates an error :
java.lang.RuntimeException: hasCode() not implemented!
at com.nutiteq.components.PlaceLabel.hashCode(Unknown Source)
at java.lang.Object.toString(Object.java:255)
at java.lang.StringBuilder.append(StringBuilder.java:209)
at micka.Mapper$3.elementEntered(Mapper.java:124)
and what kind of object i use ? it's from kml
in my case i need to click on object and getting the name of this object, is that possible ? what can i do ?
thanks you very much and i apologie for my bad english :(
ps. you probably do not want actually Label text, you want name of the Place (and maybe other KML parameters). In KML service the Label is same as Name. Then you need something like that
if (element instanceof Place) {
Place p = (Place) element;
System.out.println("Name "+p.getName());
}
thank you very much it works great !
Hello, i have a problem when i use OnMapElementListener.
I have a list of Places show on Map. I have implemented my Activity by OnMapElementListener, and i have override elementClicked(OnMapElement arg0)
but I when i click on a Place, it doesn't jump to elementClicked(OnMapElement arg0)?
Please help me.
Have you activated OnMapElementListener for MapComponent with something like following?
mapComponent.setOnMapElementListener(this);
Thanks you.
I forgot to activate OnMapElementListener for MapComponent. It works fine.
Hello
I have a problem to add places to map. I´m using the method addPlace. If I use this method before starMapping the place appear in the map, buf if I try to add a place after this, I don´t see anything in the map. I think, but I not sure, that y don´t refress the map, but I don´t now how to do this.
In the documentation I found examples for JavaME,where use a ImagWraper.
I only know add elements to map using the google maps API adding a Overlay.
Sorry for my horrible English.
I cannot replicate the issue: places are displayed in both cases. Please try also with latest library version from http://nutiteq.com/beta/lib/
hi jaak,
Im using the blackbbery api, and ran into a little problem implementing the OnMapElementListener.
I implemented the interface, elementEntered, and elementLeft worked, but elementClicked doesn't seem to do anything. Might you know what is causing this?
i think the blackberry native navigationClick method if overriding the elementClicked. So i changed the navigationClick to go to elementClicked manually, however this way I do not have the OnMapElement object that is clicked. Is there a better work around?
protected boolean navigationClick(int status, int time) {
fieldChangeNotify(1);
return true;
}
protected void fieldChangeNotify(int context) {
try {
map.getOnMapElementListener().elementClicked(null); //i have the OnMapElement object here
//this.getChangeListener().fieldChanged(this, context);
} catch (Exception e) {
}
}
what do you expect to happen with navigationClick? maybe you want to find out where is cursor currently (center of screen) and call pointerPressed and pointerReleased on this? Or maybe keyPressed with selection key code: then map object will handle this as element selection, and would find out selected element and fire Element selected event. Hopefully this gives some ideas.
Your issue is that getLabel() of OnMapElement returns Label, and you try to print it out; printing asks hash for objects and this is not implemented there. You should use getLabel() method of the Label to get the String. Something like:
Log.d("test","test3 "+arg0.getLabel().getLabel());
Right, this looks confusing.
For Android and KML context I suggest to take a look to http://code.google.com/p/textopia-android/source/browse/ project sources. This is quite simple app, but it uses many KML advanced features.
/JaakL