public ContactChangeContentObserver(Context context, Account watchedAccount) { super(null); mWatchedAccount = watchedAccount; mUrisToNotify = new LinkedHashSet<Uri>(); mContext = context; mCurrentImageUri = AccountImageHelper.getAccountPictureUri(mContext, mWatchedAccount); }
@Override public void onChange(boolean selfChange) { String newUri = AccountImageHelper.getAccountPictureUri(mContext, mWatchedAccount); if (TextUtils.equals(mCurrentImageUri, newUri)) { // no change, no need to notify return; } synchronized (mLock) { for (Uri uri : mUrisToNotify) { mContext.getContentResolver().notifyChange(uri, null); } mCurrentImageUri = newUri; } }