I'm saving a vector to sharedpreferences using Gson
This is my setters and getters but I seem to have some warning on my getter.
My setter doesn't have any warnings
Gson gson = new Gson();
String json = gson.toJson(al);
editor.putString("accountLabels", json);
editor.commit();
My getter warns me "Type safety: The expression of type Vector needs unchecked conversion to conform to Vector"
Gson gson = new Gson();
String json = myPref.getString("accountLabels", "Error");
Vector<AccountLabels> obj = gson.fromJson(json, Vector.class);
return obj;
I don't know how much of a work around it is to save objects or even vector of objects in sharedpreferences, but it seems like the best solution for me.