Example usage for android.database Cursor registerContentObserver

List of usage examples for android.database Cursor registerContentObserver

Introduction

In this page you can find the example usage for android.database Cursor registerContentObserver.

Prototype

void registerContentObserver(ContentObserver observer);

Source Link

Document

Register an observer that is called when changes happen to the content backing this cursor.

Usage

From source file:org.gnucash.android.db.DatabaseCursorLoader.java

/**
 * Registers the content observer for the cursor. 
 * @param cursor {@link Cursor} whose content is to be observed for changes
 *///from ww  w . j ava2 s.  c  o  m
protected void registerContentObserver(Cursor cursor) {
    cursor.registerContentObserver(mObserver);
}

From source file:br.com.cybereagle.androidlibrary.loader.CustomCursorLoader.java

/**
  * Registers an observer to get notifications from the content provider
  * when the cursor needs to be refreshed.
  *///  ww w . jav a  2  s.c o m
void registerContentObserver(Cursor cursor, ContentObserver observer) {
    cursor.registerContentObserver(this.observer);
}

From source file:com.seguetech.zippy.data.orm.ORMLoader.java

/**
 * Registers an observer to get notifications from the content provider
 * when the cursor needs to be refreshed.
 *///from  w  ww.j  av a 2  s.  co  m
void registerContentObserver(Cursor cursor, ContentObserver observer) {
    cursor.registerContentObserver(observer);
}

From source file:ca.jdkenney.sailstar.DBLoader.java

/**
 * Registers an observer to get notifications from the content provider
 * when the cursor needs to be refreshed.
 *///from  w w w  . j  a v a  2  s . c  o m
void registerContentObserver(Cursor cursor, ContentObserver observer) {
    cursor.registerContentObserver(mObserver);
}

From source file:org.mozilla.gecko.home.SimpleCursorLoader.java

@Override
public Cursor loadInBackground() {
    Cursor cursor = loadCursor();

    if (cursor != null) {
        // Ensure the cursor window is filled
        cursor.getCount();/*from   w  w  w  .  j  ava 2s. c  o m*/
        cursor.registerContentObserver(mObserver);
    }

    return cursor;
}

From source file:com.revesoft.itelmobiledialer.util.SQLiteCursorLoader.java

/**
 * Registers an observer to get notifications from the content provider
 * when the cursor needs to be refreshed.
 *//*w ww. j  a va 2 s  .c  o m*/
public void registerContentObserver(Cursor cursor, Uri observerUri) {
    cursor.registerContentObserver(mObserver);
    cursor.setNotificationUri(getContext().getContentResolver(), observerUri);
}

From source file:org.runnerup.util.SimpleCursorLoader.java

@Override
public Cursor loadInBackground() {
    final Cursor cursor = mDB.query(mTable, getProjection(), getSelection(), getSelectionArgs(), null, null,
            getSortOrder());/*  w ww .  j a  v a2s . c o  m*/
    if (cursor != null) {
        // Ensure the cursor window is filled
        cursor.getCount();
        cursor.registerContentObserver(mObserver);
    }
    return cursor;
}

From source file:com.michaelrnovak.objectcursor.ObjectCursorLoader.java

@Override
public ObjectCursor<T> loadInBackground() {
    final Cursor inner = getContext().getContentResolver().query(mUri, mProjection, mSelection, mSelectionArgs,
            mSortOrder);/*www . jav  a2 s .  co  m*/

    if (inner != null) {
        inner.getCount();
        inner.registerContentObserver(mObserver);
    }

    final ObjectCursor<T> cursor = getObjectCursor(inner);
    cursor.fillCache();
    return cursor;
}

From source file:eu.geopaparazzi.library.database.RawSqlCursorLoader.java

@Override
public Cursor loadInBackground() {
    synchronized (this) {
        if (isLoadInBackgroundCanceled()) {
            throw new OperationCanceledException();
        }//from  w w  w. ja  va  2s  .  co  m
        mCancellationSignal = new CancellationSignal();
    }
    try {
        Cursor cursor = mDatabase.rawQuery(mSql, null);
        if (cursor != null) {
            try {
                // Ensure the cursor window is filled.
                cursor.getCount();
                cursor.registerContentObserver(mObserver);
            } catch (RuntimeException ex) {
                cursor.close();
                throw ex;
            }
        }
        return cursor;
    } finally {
        synchronized (this) {
            mCancellationSignal = null;
        }
    }
}

From source file:catchla.yep.loader.ObjectCursorLoader.java

@Override
public ObjectCursor<T> loadInBackground() {
    Cursor cursor = query();
    if (cursor != null) {
        // Ensure the cursor window is filled
        cursor.getCount();//from   w  ww.  j  a  v a2 s  . co m
        cursor.registerContentObserver(mObserver);
    }
    if (cursor == null)
        return null;
    return new ObjectCursor<>(cursor, createIndices(cursor));
}