Commit 254b5b9d authored by Rominho15's avatar Rominho15
Browse files

Version 8.3 : Modification en cas de tableau de score vide

parent 4617bcbf
......@@ -3,6 +3,7 @@ package com.example.rleger.cassebrique.Screen;
import android.content.ClipData;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
......@@ -29,7 +30,7 @@ public class ScoreActivity extends AppCompatActivity {
int score;
String player;
String[] allStringScores = new String[10];
String[] allStringScores = new String[] {"1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.", "9.", "10."};
ListView scoresList = (ListView) findViewById(R.id.scoreListView);
ParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore");
......@@ -37,13 +38,15 @@ public class ScoreActivity extends AppCompatActivity {
query.addAscendingOrder("updatedAt");
try {
List<ParseObject> results = query.find();
for (int i = 0; i < results.size() ; i++) {
ParseObject currentLine = results.get(i);
score = currentLine.getInt("score");
player = currentLine.getString("playerName");
int place = i+1;
String date = android.text.format.DateFormat.format("dd/MM/yyyy HH:mm", currentLine.getUpdatedAt()).toString();
allStringScores[i] = place + ". " + player + ", " + date + ", " + score + " points";
if(results.size() > 0) {
for (int i = 0; i < results.size() ; i++) {
ParseObject currentLine = results.get(i);
score = currentLine.getInt("score");
player = currentLine.getString("playerName");
int place = i+1;
String date = android.text.format.DateFormat.format("dd/MM/yyyy HH:mm", currentLine.getUpdatedAt()).toString();
allStringScores[i] = place + ". " + player + ", " + date + ", " + score + " points";
}
}
} catch (ParseException e) {
e.printStackTrace();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment