Guilherme Delgado
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? πŸ™‚

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Guilherme Delgado
Guilherme Delgado

Written by Guilherme Delgado

Software Engineer at BlissApplications πŸ‡΅πŸ‡Ή β€’ github.com/GuilhE β€’ When I’m not coding I’m πŸ§—πŸ½or πŸ„β€β™‚οΈ

Responses (1)

Write a response