Code example for CopyOnWriteArrayList

Methods: add, contains

0
                mLocationManager.
                        isProviderEnabled(LocationManager.NETWORK_PROVIDER);
    } 
 
    private void addListener(MyLocationListener listener) {
        if (!mListeners.contains(listener)) {
            mListeners.add(listener);
        } 
    } 
 
    public void removeListener(MyLocationListener listener) {
        mListeners.remove(listener);
    } 
 
    private void notifyResult(Location location){
        for (MyLocationListener listener: mListeners) {
            listener.onLocationReceived(location);
        } 
    } 
 
    public synchronized boolean isGpsUpdating(){