Package com.example.iconic_raffleevent
Class UserControllerViewModel
java.lang.Object
androidx.lifecycle.ViewModel
com.example.iconic_raffleevent.UserControllerViewModel
public class UserControllerViewModel
extends androidx.lifecycle.ViewModel
ViewModel class for managing an instance of UserController.
Ensures that the UserController is created and retained across configuration changes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the UserController instance.void
setUserController
(String userID, android.content.Context context) Sets up the UserController if it has not been initialized yet.Methods inherited from class androidx.lifecycle.ViewModel
addCloseable
-
Constructor Details
-
UserControllerViewModel
public UserControllerViewModel()
-
-
Method Details
-
setUserController
Sets up the UserController if it has not been initialized yet. This method is only called once to avoid re-creating the controller.- Parameters:
userID
- the unique ID of the user.context
- the context in which the UserController operates.
-
getUserController
Retrieves the UserController instance.- Returns:
- the UserController associated with this ViewModel.
-