Just started to use Robolectric and it seems to be pretty much what I need. However, I\'ve hit a bit of a roadblock with regards to the use of SharedPreferences.
I h
The accepted answer which I have up voted is right of course. Things have changed slightly if you are using Robolectric 3
SharedPreferences sharedPreferences =
RuntimeEnvironment.application.getSharedPreferences(
"you_custom_pref_name", Context.MODE_PRIVATE);
You can then add a preference as usual
sharedPreferences.edit().putBoolean(
activity.getString(R.string.pref_somepref), true).commit();