Sorry my bad English in advance.
I would like to find out how I can clear SharedPreferences when I log out of the application. In my case, the Logout button is on screen 1 (HomePage).
On screen 2, I’m keeping items in a list that generates a Listview with several tiles. When I leave screen 2 to go to another screen, the list items must be kept so that the listview is displayed.This part kinda works.
However, when I log out of the application and log into another account, items from the account I was previously logged into appear. I am aware of the existence of .clear() but I don’t know how it would be implemented given that the list is on one screen and the logout button on another.
- I’ve tried to use clear on the HomePage screen but it didn’t work.
- Tried to create an abstract class involving SharedPreferences but turns out I am not that skillful at managing classes.
Vinícius Torres is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.