You fell to the usual trap of editing the value you got from getStringSet(). This is forbidden in the docs
You should :
SharedPreferences ss = getSharedPreferences("db", 0);
Set hs = ss.getStringSet("set", new HashSet());
Set in = new HashSet(hs);
in.add(String.valueOf(hs.size()+1));
ss.edit().putStringSet("set", in).commit(); // brevity
// SharedPreferences sss = getSharedPreferences("db", 0); // not needed
Log.i("chauster", "2.set = "+ ss.getStringSet("set", new HashSet()));
For a half baked explanation see : Misbehavior when trying to store a string set using SharedPreferences