using ContentProviderClient vs ContentResolver to access content provider

前端 未结 5 1742
广开言路
广开言路 2020-12-07 11:09

The documentation on Android content providers describes using a ContentResolver, obtained from getContentResolver(), to access the content.

<
5条回答
  •  囚心锁ツ
    2020-12-07 11:21

    I think the another import difference is ContentProviderClient can be cast into your custom provider object and access other method besides CRUD.

    ContentProvider cp = getContentResolver().acquireContentProviderClient(mCurUri).getLocalContentProvider();
    yourProvider fld = (yourProvider)cp;
    fld.query(...);           // you can query as ContentResolver
    fld.addFolder(newFolder); // also can invoke the extend method of your custom ContentProvider
    

提交回复
热议问题