Example usage for android.content ContentResolver notifyChange

List of usage examples for android.content ContentResolver notifyChange

Introduction

In this page you can find the example usage for android.content ContentResolver notifyChange.

Prototype

public void notifyChange(@NonNull Uri uri, @Nullable ContentObserver observer) 

Source Link

Document

Notify registered observers that a row was updated and attempt to sync changes to the network.

Usage

From source file:Main.java

public static void saveBrightness(Activity activity, int brightness) {
    Uri uri = Settings.System.getUriFor("screen_brightness");
    ContentResolver resolver = activity.getContentResolver();
    Settings.System.putInt(resolver, "screen_brightness", brightness);
    resolver.notifyChange(uri, null);
}

From source file:Main.java

public static void saveBrightness(Activity activity, int brightness) {
    Uri uri = android.provider.Settings.System.getUriFor("screen_brightness");
    ContentResolver resolver = activity.getContentResolver();
    android.provider.Settings.System.putInt(resolver, "screen_brightness", brightness);
    resolver.notifyChange(uri, null);
}

From source file:Main.java

public static void saveBrightness(ContentResolver resolver, int brightness) {
    Uri uri = android.provider.Settings.System.getUriFor("screen_brightness");
    android.provider.Settings.System.putInt(resolver, "screen_brightness", brightness);
    resolver.notifyChange(uri, null);
}

From source file:Main.java

public static void saveBrightness(ContentResolver resolver, int brightness) {
    Uri uri = Settings.System.getUriFor("screen_brightness");
    Settings.System.putInt(resolver, "screen_brightness", brightness);
    // resolver.registerContentObserver(uri, true, myContentObserver);
    resolver.notifyChange(uri, null);
}

From source file:Main.java

public static void saveBrightness(ContentResolver resolver, int brightness) {
    Uri uri = android.provider.Settings.System.getUriFor("screen_brightness");
    android.provider.Settings.System.putInt(resolver, "screen_brightness", brightness);
    // resolver.registerContentObserver(uri, true, myContentObserver);
    resolver.notifyChange(uri, null);
}

From source file:Main.java

public static void saveBrightness(Activity activity, int brightness) {
    ContentResolver resolver = activity.getContentResolver();
    Uri uri = android.provider.Settings.System.getUriFor("screen_brightness");
    android.provider.Settings.System.putInt(resolver, "screen_brightness", brightness);
    // resolver.registerContentObserver(uri, true, myContentObserver);
    resolver.notifyChange(uri, null);
}

From source file:Main.java

public static void setBrightness(Activity activity) {
    ContentResolver resolver = activity.getContentResolver();
    Uri uri = Settings.System.getUriFor("screen_brightness");
    int nowScreenBri = getScreenBrightness(activity);
    nowScreenBri = nowScreenBri <= 225 ? nowScreenBri + 30 : 30;
    System.out.println("nowScreenBri==" + nowScreenBri);
    Settings.System.putInt(resolver, "screen_brightness", nowScreenBri);
    resolver.notifyChange(uri, null);
}

From source file:edu.stanford.mobisocial.dungbeetle.DungBeetleContentProvider.java

static void notifyDependencies(DBHelper helper, ContentResolver resolver, String feedName) {
    Uri feedUri = Feed.uriForName(feedName);
    if (DBG)//from  w w w . j  a  va  2  s  .  c  o m
        Log.d(TAG, "notifying dependencies of  " + feedUri);
    resolver.notifyChange(feedUri, null);
    resolver.notifyChange(Feed.uriForName(Feed.FEED_NAME_GLOBAL), null);
    if (feedName.contains(":")) {
        feedName = feedName.split(":")[0];
        resolver.notifyChange(Feed.uriForName(feedName), null);
    }
    Cursor c = helper.getFeedDependencies(feedName);
    try {
        while (c.moveToNext()) {
            Uri uri = Feed.uriForName(c.getString(0));
            resolver.notifyChange(uri, null);
        }
    } finally {
        c.close();
    }
}

From source file:com.ultramegasoft.flavordex2.util.PhotoUtils.java

/**
 * Delete a thumbnail.// w w w. j  a  v  a2s  .  com
 *
 * @param context The Context
 * @param id      The entry ID
 */
public static void deleteThumb(@NonNull Context context, long id) {
    final File file = getThumbFile(context, id);
    if (file.exists()) {
        sThumbCache.remove(id);
        //noinspection ResultOfMethodCallIgnored
        file.delete();
        final ContentResolver cr = context.getContentResolver();
        final Uri uri = ContentUris.withAppendedId(Tables.Entries.CONTENT_ID_URI_BASE, id);
        cr.notifyChange(uri, null);
    }
}

From source file:us.parshall.ezandroid.activity.EZItemListActivity.java

protected OnClickListener deleteItemsListener(final EZItemListActivity activity, final String tableName) {
    return new DialogInterface.OnClickListener() {

        @Override//w w  w  .j  a  v a2  s. c  om
        public void onClick(DialogInterface dialog, int which) {
            long[] selectedItemIds = activity.getListView().getCheckedItemIds();
            String[] itemIds = new String[selectedItemIds.length];
            String[] parameters = new String[selectedItemIds.length];
            for (int i = 0; i < selectedItemIds.length; i++) {
                itemIds[i] = String.valueOf(selectedItemIds[i]);
                parameters[i] = "?";
            }
            String where = EZContentProvider.KEY_ID + " in ( " + TextUtils.join(",", parameters) + " )";

            ContentResolver cr = activity.getContentResolver();

            cr.delete(Uri.withAppendedPath(EZContentProvider.CONTENT_URI, tableName), where, itemIds);
            cr.notifyChange(Uri.withAppendedPath(EZContentProvider.CONTENT_URI, tableName), null);
            dialog.dismiss();
            activity.finish();
            activity.startActivity(activity.getIntent());
        }

    };
}