I'm using SharedPreferences to save multiple values from multiple Activities and Fragments and reuse them in various others. This works fine so far. I mostly save Integers. Is it possible to set the default value of such a SharedPreference to be empty, so when the value is shown in a TextView, the TextView will be empty? I want this for user convenience, so the user doesn't have to delete the default value in the field, if he wants to change it.
Here is an example of what I mean:
SharedPreferences sharedPref = getSharedPreferences("Datenspeicher", Context.MODE_PRIVATE);
int Stk_jahr = sharedPref.getInt("sp_stueckzahl", 0);
Stueckzahl.setText(String.valueOf(Stk_jahr));
In this example, if no value is saved in sp_stueckzahl, die TextView Stueckzahl will show a 0. I would prefer it to be empty.
Thank you