1 min readJul 1, 2020
No no no, sorry π , let me try again:
By using Hilt you just have to do something like:
Intent(this, StoreDetailActivity::class.java).apply { store?.let { putExtra(EXTRA_FOR_STORE, it) } }.let(this::startActivity)
And then inside your ViewModel:
class StoreDetailViewModel @ViewModelInject constructor(
@Assisted private val stateHandle: SavedStateHandle,
...
) : ViewModel() {
private val _store = stateHandle.getLiveData(StoreActivity.EXTRA_FOR_STORE, Store())
You'll have access to your extras and savedStateHandle out of the box :)
Did I make it clear now? π