Example usage for android.content ContentProviderOperation getUri

List of usage examples for android.content ContentProviderOperation getUri

Introduction

In this page you can find the example usage for android.content ContentProviderOperation getUri.

Prototype

public Uri getUri() 

Source Link

Document

Gets the Uri for the target of the operation.

Usage

From source file:org.coocood.vcontentprovider.VContentProvider.java

@Override
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
        throws OperationApplicationException {
    db = mOpenHelper.getWritableDatabase();
    ContentProviderResult[] results;//from ww w. j  a v  a 2 s.co m

    HashSet<Uri> tempUris = new HashSet<Uri>();
    for (ContentProviderOperation operation : operations) {
        tempUris.add(operation.getUri());
    }

    db.beginTransaction();
    batchingUris.addAll(tempUris);
    try {
        results = super.applyBatch(operations);
        db.setTransactionSuccessful();
    } finally {
        batchingUris.removeAll(tempUris);
        db.endTransaction();
    }
    for (Uri uri : tempUris) {
        notifyChange(uri, 1);
    }
    return results;
}