Kotlin Koin
Koin
Koin
Di (Dependense Injection) するためにはDagger2, HiltがあるがKotlinらしくなくて使い方がやや口説くなることがあったのでIntelliJ社はKotlin専用のDIライブラリのKoinを作った。
KoinはKotlinらしく使いやすい、簡単なのでDIなんかを初めて触った素人も即座で使える。
https://insert-koin.io/
早速やって見よう。
build.gradle(Project: xxx) に追加
// Add Maven Central to your repositories if needed
repositories {
mavenCentral()
}
dependencies...
-
This is Slide 1 Title
This is slide 1 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...
-
This is Slide 2 Title
This is slide 2 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...
-
This is Slide 3 Title
This is slide 3 description. Go to Edit HTML and replace these sentences with your own words. This is a Blogger template by Lasantha - PremiumBloggerTemplates.com...
2021년 5월 7일 금요일
2021년 5월 6일 목요일
Dagger2 ( Java -> Kotlin )
By schoolhompy at 5월 06, 2021
No comments
Dagger2 ( Java -> Kotlin )
Dagger2 ( Java -> Kotlin )
Basic
Dagger2 ( Java -> Kotlin )
Dagger から Hilt, Koinに 引越しする前に覚えたことを忘れないうちに書いておきたいと思ってここに書き留める。
参考:DIというのは。
DIは外部から機能を注入することでなるべくインスタンスを生成しないようにするのが基本概念だ。
DIを使わないとインタフェースを使って同じく実現できるがそんなことしようとすると作るファイル数が増えるのでめんどくさくなるので普通はDIライブラリーを使う。
プログラミングにてDIの仕組みは外部に自分が定義したモジュール単位のクラスを使いたいインスタンス変数にタイプを合わせて注入して使うことだ。
作ったモジュールがインスタンス変数に注入されるのはDIライブラリーがやってくれるので指定だけやればDIが実現できる。
Android...
Android 개발팁메모장
By schoolhompy at 5월 06, 2021
No comments
라이프사이클
외워서 그릴줄 알아야 한다.
Activity/Fragment 생명주기
https://techbooster.org/wp-content/uploads/2014/12/lifecycle.png
https://github.com/xxv/android-lifecycle
onAttach(Fragment Only)
Fragment 에만 있는 싸이클로서 Fragment 가 Activity 에 붙을때 실행된다.
onActivityCreated(Fragment Only)
onCreate
액티비티를 최초에 실행할때 호출한다. 리소스 , layout 등의 초기화 작업을 한다. 또한 액티비티가 살아있는 동안에 유지해야 할 변수나 기능들을 초기화하고 보관해놓는다.
onCreateView(Fragment Only)
Fragment...