ray
ray

Reputation: 4250

Android how to add more than one ContentProvider in Android?

  1. Is this possible to use more than one ContentProvider?

  2. If possible how to declare in manifest? I tried using following way but getContentResolver() is getting only the first provider.

        <provider
            android:name=".bean.ItemBean"
            android:authorities="com.waveletandroid.bean" >
        </provider>
    
       <provider
            android:name=".bean.CustomerBean"
            android:authorities="com.waveletandroid.bean" >
        </provider>
    

Upvotes: 4

Views: 278

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

Is this possible to use more than one ContentProvider?

Yes. Or, you can have one ContentProvider that provides multiple data sets, based upon the path portion of the Uri or via different authorities.

If possible how to declare in manifest?

What you have is almost correct. They cannot both have the same authority, though. Change one to be something else (e.g., com.waveletandroid.bean2).

Upvotes: 6

Related Questions