ContentProvider attachInfo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ContentProvider attachInfo method.

This code example shows how to use the following methods:attachInfo
 
        ChromiumTestShellActivity activity = launchChromiumTestShellWithUrl(null);
        assertNotNull(activity);
 
        ContentProvider provider = new ChromeBrowserProvider();
        provider.attachInfo(activity, null);
 
        MockContentResolver resolver = new MockContentResolver();
        resolver.addProvider(ChromeBrowserProvider.getApiAuthority(activity), provider);
        resolver.addProvider(ChromeBrowserProvider.getInternalAuthority(activity), provider);
 
        mContext = new IsolatedContext(resolver, activity);
        assertTrue(getContentResolver() instanceof MockContentResolver);
    } 
 
    protected ContentResolver getContentResolver() {
        return mContext.getContentResolver();
    } 
} 
5
CodeRank
This code example shows how to use the following methods:attachInfo
 
        mResolver = new MockContentResolver();
        mProviderContext = new MockMusubiAppContext(getContext());
 
        mProvider = mProviderClass.newInstance();
        mProvider.attachInfo(mProviderContext, null);
        assertNotNull(mProvider);
        mResolver.addProvider(mProviderAuthority, getProvider());
    } 
    @Override 
    protected void tearDown() throws Exception { 
    	if(Build.VERSION.SDK_INT >= 11) {
    		//mProvider.shutdown();  
    	} 
        super.tearDown(); 
    } 
    public MockContentResolver getMockContentResolver() {
        return mResolver;
    } 
    public MockMusubiAppContext getMockContext() { 
4
CodeRank
This code example shows how to use the following methods:attachInfo
		} 
		 
		private void init(String authority, Class<P> providerClass) throws Exception{
			mResolver = new MockContentResolver();
			P mProvider = providerClass.newInstance();
			mProvider.attachInfo(this, null);
			assertNotNull(mProvider);
			mResolver.addProvider(authority, mProvider);
		} 
		 
		@Override 
		public ContentResolver getContentResolver(){
			return mResolver;
		} 
	} 
} 
4
CodeRank
This code example shows how to use the following methods:attachInfo
        provider.setDataWipeEnabled(false);
        provider.attachInfo(providerContext, null);
        resolver.addProvider(ContactsContract.AUTHORITY, provider);
 
        ContentProvider callLogProvider = new TestCallLogProvider();
        callLogProvider.attachInfo(providerContext, null);
        resolver.addProvider(CallLog.AUTHORITY, callLogProvider);
 
        LegacyContactImporter importer = new LegacyContactImporter(providerContext, provider);
 
        provider.wipeData();
 
        long start = System.currentTimeMillis();
        if (TRACE) {
            Debug.startMethodTracing("import");
        } 
        provider.importLegacyContacts(importer);
        if (TRACE) {
            Debug.stopMethodTracing();
        } 
4
CodeRank
This code example shows how to use the following methods:attachInfo
        super.setUp(); 
 
        mActor = new ContactsActor(getContext(), PACKAGE_GREY, getProviderClass(), getAuthority());
        mResolver = mActor.resolver;
        if (mActor.provider instanceof SynchronousContactsProvider2) {
            ((SynchronousContactsProvider2) mActor.provider)
                    .getDatabaseHelper(mActor.context).wipeData();
        } 
    } 
 
    @Override 
    protected void tearDown() throws Exception { 
        if (mActor.provider instanceof SynchronousContactsProvider2) {
            ((SynchronousContactsProvider2) mActor.provider)
                    .getDatabaseHelper(mActor.context).close();
        } 
        super.tearDown(); 
    } 
 
    public Context getMockContext() {
3
CodeRank
This code example shows how to use the following methods:attachInfo
		} 
		 
		private void init(String authority, Class<P> providerClass) throws Exception{
			mResolver = new MockContentResolver();
			P mProvider = providerClass.newInstance();
			mProvider.attachInfo(this, null);
			assertNotNull(mProvider);
			mResolver.addProvider(authority, mProvider);
		} 
		 
		@Override 
		public ContentResolver getContentResolver(){
			return mResolver;
		} 
	} 
} 
4
CodeRank
This code example shows how to use the following 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 "com.example.red", and also cause the {@link PackageManager} 
     * to report that no UID contains that package name. 
     */ 
4
CodeRank
This code example shows how to use the following methods:attachInfo
 
        ChromiumTestShellActivity activity = launchChromiumTestShellWithUrl(null);
        assertNotNull(activity);
 
        ContentProvider provider = new ChromeBrowserProvider();
        provider.attachInfo(activity, null);
 
        MockContentResolver resolver = new MockContentResolver();
        resolver.addProvider(ChromeBrowserProvider.getApiAuthority(activity), provider);
        resolver.addProvider(ChromeBrowserProvider.getInternalAuthority(activity), provider);
 
        mContext = new IsolatedContext(resolver, activity);
        assertTrue(getContentResolver() instanceof MockContentResolver);
    } 
 
    protected ContentResolver getContentResolver() {
        return mContext.getContentResolver();
    } 
} 
4
CodeRank
This code example shows how to use the following methods:attachInfo
	                getContext(), // The context that file methods are delegated to
	                filenamePrefix);
	        mProviderContext = new MyIsolatedContext(mResolver, targetContextWrapper);
 
	        mProvider = mProviderClass.newInstance();
	        mProvider.attachInfo(mProviderContext, null);
	        assertNotNull(mProvider);
	        mResolver.addProvider(mProviderAuthority, getProvider());
	    } 
 
	  public static <T extends ContentProvider> ContentResolver newResolverWithContentProviderFromSql(
	            Context targetContext, String filenamePrefix, Class<T> providerClass, String authority,
	            String databaseName, int databaseVersion, String sql)
	            throws IllegalAccessException, InstantiationException { 
	        MockContentResolver resolver = new MockContentResolver();
	        RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(
	                new MockContext(), // The context that most methods are delegated to
	                targetContext, // The context that file methods are delegated to
	                filenamePrefix);
	        Context context = new IsolatedContext(resolver, targetContextWrapper);
4
CodeRank
This code example shows how to use the following methods:attachInfo
attachInfo Method Overview
After being instantiated, this is called to tell the content provider about itself.
See Code Examples for other Android ContentProvider Methods: