Sheehan Alam
Sheehan Alam

Reputation: 60919

Why isn't SharedPreferences saving my string?

I have an ArrayList that I'm writing out as a string:

blastScores  = new ArrayList<String>();
blastScores.add("Hello");
blastScores.add("Yo");
prefs.edit().putString(CaptureActivity.BLAST_SCORES, blastScores.toString());

Whenever I read it in, it is always null:

    String blastScoresString = prefs.getString(CaptureActivity.BLAST_SCORES, null);

Why is this?

Upvotes: 0

Views: 105

Answers (1)

curioustechizen
curioustechizen

Reputation: 10672

Have you done a commit() on the SharedPreferences.Editor object?

Upvotes: 8

Related Questions