Skip to content

Instantly share code, notes, and snippets.

@alejandro-rios
Last active September 13, 2019 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandro-rios/ecb7dbe75863b4faa7049a9bc11f85a9 to your computer and use it in GitHub Desktop.
Save alejandro-rios/ecb7dbe75863b4faa7049a9bc11f85a9 to your computer and use it in GitHub Desktop.
Basic Hello World with Katana
class Info(val text: String)
// Module
val bag = Module {
singleton { Info("Hello Katana") }
}
// MainActivity
class MainActivity : AppCompatActivity() {
// Component
private val component = Component(modules = listOf(bag))
// Retrieve Dependencies
private val magicBox: Info by component.inject()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
text_view.text = magicBox.text
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment