scoreSaveReturn():
Get from Sh Pref store in array int[5], delete all Sh Pref, if score appropriate add it to array, populate Sh Pref and return top five scores as string.
THE 2ND block detected erroneous (if disabled - works with fixed value returned) WHERE THE PROBLEM? 1ST AFTER FOLLOW SECOND IN CODE SEQUENCE
1// this block detected NO ERROR
2
3savedHighScores = getSharedPreferences("highScores", MODE_PRIVATE);
4
5private String scoreSaveReturn(int totalPoints) {
6 SharedPreferences.Editor preferencesEditor = savedHighScores.edit();
7 String[] tags = savedHighScores.getAll().keySet().toArray(new String[0]);
8 int[] scores = new int[5];
9....................
same method(scoreSaveReturn) continues below2
3savedHighScores = getSharedPreferences("highScores", MODE_PRIVATE);
4
5private String scoreSaveReturn(int totalPoints) {
6 SharedPreferences.Editor preferencesEditor = savedHighScores.edit();
7 String[] tags = savedHighScores.getAll().keySet().toArray(new String[0]);
8 int[] scores = new int[5];
9....................
1...............
2 // this block detected erroneous WHERE THE PROBLEM? Tried to populate array int[5] from Shared Pref.
3for (int k = 0; k<5; k++) {
4 scores[k]=savedHighScores.getInt(tags[k],0);
5}
6 preferencesEditor.clear();
7 preferencesEditor.apply();
.............other code works OK.
2 // this block detected erroneous WHERE THE PROBLEM? Tried to populate array int[5] from Shared Pref.
3for (int k = 0; k<5; k++) {
4 scores[k]=savedHighScores.getInt(tags[k],0);
5}
6 preferencesEditor.clear();
7 preferencesEditor.apply();
