Search code examples
androidkoin

Can I use Koin's currentScope in Java Activities?


I want to use currentScope (https://github.com/InsertKoinIO/koin/search?q=currentscope&unscoped_q=currentscope) in an Activity written in Java.

But it doesn't seem like I can import org.koin.android.scope.currentScope in a Java activity.

Does anyone have any experience using Activity scopes in Java activities?


Solution

  • You can use it this way

    org.koin.android.scope.LifecycleOwnerExtKt.getCurrentScope()