如何使用Koin注入contentResolver

时间:2020-07-27 08:46:48

标签: android android-contentresolver koin koin-scope

我正在尝试在数据源类中注入带有koin的contentProvider,但找不到任何方法可以做到这一点。

这是我的数据源

class MyDataSource(private val application: Application, private val contentProvider: ContentResolver) : MyRepository {...}

和我的koin模块

single<MyRepository> {
        MyDataSource(get(), get())
    }

我收到此错误:

起因:org.koin.core.error.NoBeanDefFoundException:找不到“ android.content.ContentResolver”的定义。检查您的模块定义。

1 个答案:

答案 0 :(得分:0)

告诉Koin如何获得N = 5; A = dec2bin(1:2^N-2)-'0'; % step 1 [~, ind] = sortrows([sum(A,2) -A]); % step 2 result = [ones(1,N); A(ind,:)]; % step 3 。假设您在自定义ContentResolver(例如Application)类中初始化模块:

MyApplication