Code example for ContentProvider

Methods: attachInfo

    public ContentProvider addProvider(Class<? extends ContentProvider> providerClass,
            String authority) throws Exception {
        ContentProvider provider = providerClass.newInstance();
        provider.attachInfo(mProviderContext, null);
        resolver.addProvider(authority, provider);
        return provider;
     * Mock {@link Context} that reports specific well-known values for testing 
     * data protection. The creator can override the owner package name, and 
     * force the {@link PackageManager} to always return a well-known package 
     * list for any call to {@link PackageManager#getPackagesForUid(int)}. 
     * <p> 
     * For example, the creator could request that the {@link Context} lives in 
     * package name "", and also cause the {@link PackageManager} 
     * to report that no UID contains that package name.