public void removeOnEventChangeListener(OnEventListenerChange listener) { for (WeakReference<OnEventListenerChange> ref : eventChangeListeners) { OnEventListenerChange l = ref.get(); if (l != null) { if (l.equals(listener)) { eventChangeListeners.remove(ref); break; } } } }
protected void dispatchOnEventChange( boolean added, String eventName, int count, KrollProxy proxy) { for (WeakReference<OnEventListenerChange> ref : eventChangeListeners) { OnEventListenerChange l = ref.get(); if (l != null) { try { if (added) { l.eventListenerAdded(eventName, count, proxy); } else { l.eventListenerRemoved(eventName, count, proxy); } } catch (Throwable t) { Log.e(TAG, "Error invoking OnEventChangeListener: " + t.getMessage(), t); } } } }