Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LEGER ROMAIN
CasseBrique
Commits
254b5b9d
Commit
254b5b9d
authored
Jan 09, 2016
by
Rominho15
Browse files
Version 8.3 : Modification en cas de tableau de score vide
parent
4617bcbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/example/rleger/cassebrique/Screen/ScoreActivity.java
View file @
254b5b9d
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment