Created
February 1, 2020 10:01
-
-
Save diousk/55671c056038629b003c7590c2322e6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : FragmentInjectActivity() { | |
@Inject lateinit var vmFactory: ViewModelProvider.Factory | |
private val viewModel by viewModels<MainViewModel> { vmFactory } | |
@Inject lateinit var fragmentFactory: FragmentFactory | |
override fun beforeOnCreate() { | |
supportFragmentManager.fragmentFactory = fragmentFactory | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
supportFragmentManager.beginTransaction() | |
.add<DummyFragment>(R.id.fragmentContainer) | |
.commitAllowingStateLoss() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment