Code example for ContentResolver

Methods: registerContentObserver

0
        mLocale = locale;
    } 
 
    @Override 
    protected void registerObserver(ContentObserver dictionaryContentObserver, ContentResolver contentResolver) {
        contentResolver.registerContentObserver(Words.CONTENT_URI, false, dictionaryContentObserver);
    } 
 
    public WordsCursor getWordsCursor() { 
        Cursor cursor = TextUtils.isEmpty(mLocale) ?
                mContext.getContentResolver().query(Words.CONTENT_URI, PROJECTION, "(" + Words.LOCALE + " IS NULL)", null, null) :
                mContext.getContentResolver().query(Words.CONTENT_URI, PROJECTION, "(" + Words.LOCALE + " IS NULL) or (" + Words.LOCALE + "=?)", new String[]{mLocale}, null);
 
        if (cursor == null) throw new RuntimeException("No built-in Android dictionary!");
 
        return new WordsCursor(cursor);
    } 
 
    @Override 
    protected void AddWordToStorage(String word, int frequency) {
Experience pair programming with AI  Get Codota for Java