Code example for ContentResolver

Methods: registerContentObserver

0
        super.onPause(); 
        mContentResolver.unregisterContentObserver(simChangeObserver);
    } 
 
    private void registerSimChangeObserver() { 
        mContentResolver.registerContentObserver(
                ICC_URI, true, simChangeObserver);
    } 
 
    private void copyToPhoneMemory(Cursor cursor) {
        String address = cursor.getString(
                cursor.getColumnIndexOrThrow("address"));
        String body = cursor.getString(cursor.getColumnIndexOrThrow("body"));
        Long date = cursor.getLong(cursor.getColumnIndexOrThrow("date"));
 
        try { 
            if (isIncomingMessage(cursor)) {
                Sms.Inbox.addMessage(mContentResolver, address, body, null, date, true);
            } else { 
                Sms.Sent.addMessage(mContentResolver, address, body, null, date);
Stop searching for code, let great code find you!  Add Codota to your java IDE