Created
June 7, 2024 07:19
-
-
Save LloydBlv/b24286abd5a3e8bece3f12055cf550c9 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
// In a Fragment | |
class UserFragment : Fragment() { | |
private val userViewModel: UserViewModel by viewModels() | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
val userId = "12345" // Get this from arguments or somewhere else | |
userViewModel.fetchUserData(userId) // Called from Fragment | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment