Hey guys...
I try to save the best score of a Level...
getting the best score for a Level works...
But writing just works on my computer and not in the gallery.
I tried different codes:
I although tried:
Where is my mistake?
public static void SaveLevelScore(int i_ReachedScore,int i_Level) try { int[] i_LastScore = ScoreReader.getScores(); if(i_ReachedScore<i_LastScore[i_Level]) return; i_LastScore[i_Level] = i_ReachedScore; OutputStream OS = new FileOutputStream("Scores.txt"); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(OS)); for(int i=0; i<i_LastScore.length;i++) writer.write(i+"#"+i_LastScore[i]+"\n"); writer.close(); } catch(Exception e) { System.out.println(e.getMessage()); }
public static void SaveLevelScore(int i_ReachedScore,int i_Level) try { int[] i_LastScore = ScoreReader.getScores(); if(i_ReachedScore<i_LastScore[i_Level]) return; i_LastScore[i_Level] = i_ReachedScore; FileWriter fw = new FileWriter("Scores.txt"); BufferedWriter writer = new BufferedWriter(fw); for(int i=0; i<i_LastScore.length;i++) writer.write(i+"#"+i_LastScore[i]+"\n"); writer.close(); } catch(Exception e) { System.out.println(e.getMessage()); }