Example usage for android.content ContentProviderClient getLocalContentProvider

List of usage examples for android.content ContentProviderClient getLocalContentProvider

Introduction

In this page you can find the example usage for android.content ContentProviderClient getLocalContentProvider.

Prototype

public @Nullable ContentProvider getLocalContentProvider() 

Source Link

Document

Get a reference to the ContentProvider that is associated with this client.

Usage

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

public static DBHelper getGlobal(Context context) {
    ContentProviderClient cpc = context.getContentResolver()
            .acquireContentProviderClient(DungBeetleContentProvider.CONTENT_URI);
    try {/* ww  w. j  a v a  2 s  .c om*/
        DungBeetleContentProvider dbcp = (DungBeetleContentProvider) cpc.getLocalContentProvider();
        return dbcp.getDBHelper();
    } finally {
        cpc.release();
    }
}

From source file:com.robotoworks.mechanoid.db.SQuery.java

private MechanoidContentProvider getContentProvider(Uri uri) {

    if (mProvider != null) {
        return mProvider;
    }/* w ww.ja v a  2 s  .c o m*/

    ContentResolver resolver = Mechanoid.getContentResolver();

    ContentProviderClient client = resolver.acquireContentProviderClient(uri);

    MechanoidContentProvider provider = (MechanoidContentProvider) client.getLocalContentProvider();
    return provider;
}