Until now I have been changing User in MutableLiveData<ArrayList<User>>
by deleting and adding User(with updated attributes)
Is there any other option to update a User in ArrayList
of MutableLiveData<ArrayList<User>>?
Until now I have been changing User in MutableLiveData<ArrayList<User>>
by deleting and adding User(with updated attributes)
Is there any other option to update a User in ArrayList
of MutableLiveData<ArrayList<User>>?
If you want to update a user in the
ArrayList
within aMutableLiveData
, you don't necessarily need to delete and re-add the user. You can follow these steps:Step 1: Retrieve the current list
Step 2: Find the user to update
Step 3: Update the attributes of the user
Step 4: Update the MutableLiveData with the modified list