0

I am developing an Android App. I need to clear the data programmatically including the datastore preferences and room data when i press a button.

Rohit Jakhar
  • 689
  • 2
  • 9
  • 17
RussVirtuoso
  • 898
  • 1
  • 9
  • 18

1 Answers1

4

To clear the Shared Prefrences :

SharedPreferences settings = getActivity().getSharedPreferences("cda-preferences", Context.MODE_PRIVATE); 
        settings.edit().clear().commit();

and use the delete query for the database :)

GrIsHu
  • 28,867
  • 10
  • 63
  • 100
Prachi
  • 3,476
  • 2
  • 22
  • 39