My app uses PreferenceManager.getDefaultSharedPreferences(getBaseContext())
and then sets a couple of preference values. While running tests I want to clear these values and start off from a known state. Is there any way default shared preferences can be set up or initialized in the setUp function?
The code you need is as following:
If your application uses any different shared preferences you may need to clear them too in the following way: