Example usage for android.database DataSetObserver onInvalidated

List of usage examples for android.database DataSetObserver onInvalidated

Introduction

In this page you can find the example usage for android.database DataSetObserver onInvalidated.

Prototype

public void onInvalidated() 

Source Link

Document

This method is called when the entire data becomes invalid, most likely through a call to Cursor#deactivate() or Cursor#close() on a Cursor .

Usage

From source file:com.entertailion.android.slideshow.images.ImageManager.java

/**
 * Called when something changes in our data set. Cleans up any weak
 * references that are no longer valid along the way.
 *///from   w w w  .ja  va  2s .c  om
public void notifyInvalidateObservers() {
    Log.d(LOG_TAG, "notifyInvalidateObservers: " + loading);
    if (loading) {
        final ArrayList<WeakReference<DataSetObserver>> observers = dataSetObservers;
        final int count = observers.size();
        for (int i = count - 1; i >= 0; i--) {
            final WeakReference<DataSetObserver> weak = observers.get(i);
            final DataSetObserver obs = weak.get();
            if (obs != null) {
                obs.onInvalidated();
            } else {
                observers.remove(i);
            }
        }
    }
}

From source file:com.partytv.server.ImageManager.java

/**
 * Called when something changes in our data set. Cleans up any weak
 * references that are no longer valid along the way.
 *//*from w  ww  . j  av  a 2  s .co m*/
private void notifyInvalidateObservers() {
    final ArrayList<WeakReference<DataSetObserver>> observers = mObservers;
    final int count = observers.size();
    for (int i = count - 1; i >= 0; i--) {
        final WeakReference<DataSetObserver> weak = observers.get(i);
        final DataSetObserver obs = weak.get();
        if (obs != null) {
            obs.onInvalidated();
        } else {
            observers.remove(i);
        }
    }
}