Search in sources :

Example 96 with ContentObserver

use of android.database.ContentObserver in project 360-Engine-for-Android by 360.

the class NativeContactsApi1 method registerObserver.

/**
 * @see NativeContactsApi#registerObserver(ContactsObserver)
 */
@Override
public void registerObserver(ContactsObserver observer) {
    if (mContactsObserver != null) {
        throw new RuntimeException("NativeContactsApi1.registerObserver(): current implementation only supports one observer" + " at a time... Please unregister first.");
    }
    mContactsObserver = observer;
    mNativeObserver = new ContentObserver(new Handler()) {

        @Override
        public void onChange(boolean selfChange) {
            mContactsObserver.onChange();
        }
    };
    mCr.registerContentObserver(Contacts.CONTENT_URI, true, mNativeObserver);
}
Also used : Handler(android.os.Handler) ContentObserver(android.database.ContentObserver)

Aggregations

ContentObserver (android.database.ContentObserver)96 Handler (android.os.Handler)41 Uri (android.net.Uri)35 ContentResolver (android.content.ContentResolver)28 Intent (android.content.Intent)16 IntentFilter (android.content.IntentFilter)16 BroadcastReceiver (android.content.BroadcastReceiver)9 Context (android.content.Context)9 PendingIntent (android.app.PendingIntent)7 RemoteException (android.os.RemoteException)7 Test (org.junit.Test)7 AppOpsManager (android.app.AppOpsManager)6 GeofenceManager (com.android.server.location.GeofenceManager)6 LocationBlacklist (com.android.server.location.LocationBlacklist)6 LocationFudger (com.android.server.location.LocationFudger)6 HashSet (java.util.HashSet)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 Mockito.doAnswer (org.mockito.Mockito.doAnswer)6 InvocationOnMock (org.mockito.invocation.InvocationOnMock)6 Answer (org.mockito.stubbing.Answer)6