Last active
August 24, 2022 10:53
-
-
Save bhavesh3005sharma/f167789cc29973d30ce9c2e216939ef2 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
@AndroidEntryPoint | |
class SampleFragment : Fragment() { | |
// No need to extract it here | |
// private val expId by lazy { intent?.getStringExtra("EXPERIMENT_ID") } | |
val viewModel: SampleViewModel by activityViewModels() | |
..... | |
..... | |
} |
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
@HiltViewModel | |
class SampleViewModel @Inject constructor( | |
savedStateHandle: SavedStateHandle, | |
var sampleRepository: SampleRepository, | |
) : ViewModel() { | |
val expId by lazy { | |
savedStateHandle.get<String>("EXPERIMENT_ID") | |
} | |
.... | |
.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment