hi could anyone explain me about how the event Listeners work in java,To get the data based on the event occurs in outside the application.
I have this method in one of my API class I am not understanding how this methods are going to work.
publicinterfaceSBXPCXMLEventListener{
publicvoidOnReceiveEventXML(String eventXML);
}
privatestaticList<SBXPCXMLEventListener> listenerList =newArrayList<SBXPCXMLEventListener>();
protectedstaticvoid fireXMLEvent(String xml){
Iterator<SBXPCXMLEventListener> iter = listenerList.iterator();
while(iter.hasNext()){
iter.next().OnReceiveEventXML(xml);
}
}
publicstaticvoid addXMLListener(SBXPCXMLEventListener listener){
listenerList.add(listener);
}
publicstaticObject removeXMLListener(SBXPCXMLEventListener listener){
return listenerList.remove(listener);
}
i have done like this.This is used to capture the events from the fingerprint machine when run this class I am not getting any data from the machine when i did thumb impression in the machine.
public class EventListnere implements SBXPCXMLEventListener {
public static void main(String[] args) {
boolean flag = SBXPCProxy.ConnectTcpip(1, "10.0.0.8", 5005, 1234);
System.out.println("flag = " + flag);
// SBXPCProxy.st
// System.out.println("before "+System.currentTimeMillis());
boolean flag1 = SBXPCProxy.StartEventCapture(1, 1, 1);
EventListnere el = new EventListnere();
SBXPCProxy.addXMLListener(el);
}
@Override
public void OnReceiveEventXML(String eventXML) {
System.out.println("eventXML = " + eventXML);
}
}