I see a main problem here and it's the following line:
i=i++;
This will not change i
at all. You're telling it to increment i but at the same time setting i to the value prior to incrementing it. i++;
is what you want.
Also I'd suggest using SharedPreferences.Editor.putStringSet()
instead of putString()
- that way you don't need to care about size and so on.