So I have some shared preferences:
public SharedPreferences prefs = this.getSharedPreferences("com.example.me1jmo.insult_generator", Context.MODE_PRIVATE);
And I am adding new key value pairs to it like so:
int number = prefs.getAll().size();
int newkey = ++number;
String newkeystring = "" + newkey;
prefs.edit().putString(newkeystring,saved).commit();
However I don't want to add a string that has already been added. So I want to check that the string I am adding is not already a value in my shared preferences. What would be the best way to go about this?
(or could I just switch my values and keys around and check that I don't already have that key in my shared preferences)