Skip to content

Instantly share code, notes, and snippets.

@Audhil
Created July 27, 2019 19:04
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 Audhil/f786e66a355a1bd87f8a07724ea51884 to your computer and use it in GitHub Desktop.
Save Audhil/f786e66a355a1bd87f8a07724ea51884 to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
@Inject lateinit var info: Info
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
DaggerMagicBox.create().poke(this)
text_view.text = info.text
}
}
class Info @Inject constructor() {
val text = "Hello Dagger 2"
}
@Component
interface MagicBox {
fun poke(app: MainActivity)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment