質問編集履歴
4
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,7 +132,7 @@
|
|
132
132
|
|
133
133
|
handler.removeCallbacks(updateTimer1);
|
134
134
|
|
135
|
-
handler.postDelayed(updateTimer1,
|
135
|
+
handler.postDelayed(updateTimer1,30000);
|
136
136
|
|
137
137
|
}
|
138
138
|
|
@@ -146,7 +146,7 @@
|
|
146
146
|
|
147
147
|
};
|
148
148
|
|
149
|
-
handler.postDelayed(updateTimer1,
|
149
|
+
handler.postDelayed(updateTimer1,30000);
|
150
150
|
|
151
151
|
|
152
152
|
|
3
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
public final static String SCORE = "
|
19
|
+
public final static String SCORE = "com.sample.SCORE";
|
20
20
|
|
21
21
|
|
22
22
|
|
2
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
```
|
10
|
+
|
11
|
+
|
10
12
|
|
11
13
|
|
12
14
|
|
@@ -60,6 +62,18 @@
|
|
60
62
|
|
61
63
|
|
62
64
|
|
65
|
+
@Override
|
66
|
+
|
67
|
+
public void onResume (){
|
68
|
+
|
69
|
+
super.onResume();
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
|
63
77
|
public void get_11(){
|
64
78
|
|
65
79
|
|
@@ -84,19 +98,15 @@
|
|
84
98
|
|
85
99
|
|
86
100
|
|
87
|
-
i
|
101
|
+
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss.SSS", Locale.US);
|
88
102
|
|
89
|
-
|
103
|
+
timetxt.setText(simpleDateFormat.format(t));
|
90
104
|
|
91
|
-
handler.postDelayed(updateTimer,10);
|
92
105
|
|
93
|
-
}
|
94
106
|
|
95
|
-
else
|
107
|
+
handler.removeCallbacks(updateTimer);
|
96
108
|
|
97
|
-
|
109
|
+
handler.postDelayed(updateTimer,10);
|
98
|
-
|
99
|
-
}
|
100
110
|
|
101
111
|
|
102
112
|
|
@@ -114,13 +124,33 @@
|
|
114
124
|
|
115
125
|
public void run() {
|
116
126
|
|
117
|
-
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss.SSS", Locale.US);
|
118
127
|
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
if (t < 30000){
|
132
|
+
|
133
|
+
handler.removeCallbacks(updateTimer1);
|
134
|
+
|
119
|
-
|
135
|
+
handler.postDelayed(updateTimer1,10);
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
else {
|
140
|
+
|
141
|
+
get_12();
|
142
|
+
|
143
|
+
}
|
120
144
|
|
121
145
|
}
|
122
146
|
|
123
147
|
};
|
148
|
+
|
149
|
+
handler.postDelayed(updateTimer1,10);
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
124
154
|
|
125
155
|
|
126
156
|
|
1
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,6 +7,56 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
```
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
public class Game extends AppCompatActivity {
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
public final static String SCORE = "jp.gr.java_conf.htttapp.hansya.SCORE";
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
private TextView timetxt;
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
int num;
|
26
|
+
|
27
|
+
int score = 0;
|
28
|
+
|
29
|
+
long startTime;
|
30
|
+
|
31
|
+
long t;
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
private Handler handler = new Handler();
|
38
|
+
|
39
|
+
private Runnable updateTimer;
|
40
|
+
|
41
|
+
private Runnable updateTimer1;
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
@Override
|
46
|
+
|
47
|
+
protected void onCreate(Bundle savedInstanceState) {
|
48
|
+
|
49
|
+
super.onCreate(savedInstanceState);
|
50
|
+
|
51
|
+
setContentView(R.layout.activity_game);
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
get_11();
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
}
|
10
60
|
|
11
61
|
|
12
62
|
|
@@ -32,15 +82,11 @@
|
|
32
82
|
|
33
83
|
t = SystemClock.elapsedRealtime() - startTime;
|
34
84
|
|
35
|
-
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss.SSS", Locale.US);
|
36
|
-
|
37
|
-
timetxt.setText(simpleDateFormat.format(t));
|
38
|
-
|
39
|
-
handler.removeCallbacks(updateTimer);
|
40
|
-
|
41
85
|
|
42
86
|
|
43
87
|
if (t < 30000){
|
88
|
+
|
89
|
+
handler.removeCallbacks(updateTimer);
|
44
90
|
|
45
91
|
handler.postDelayed(updateTimer,10);
|
46
92
|
|
@@ -60,21 +106,25 @@
|
|
60
106
|
|
61
107
|
handler.postDelayed(updateTimer,10);
|
62
108
|
|
109
|
+
|
110
|
+
|
111
|
+
updateTimer1 = new Runnable() {
|
112
|
+
|
113
|
+
@Override
|
114
|
+
|
115
|
+
public void run() {
|
116
|
+
|
117
|
+
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss.SSS", Locale.US);
|
118
|
+
|
119
|
+
timetxt.setText(simpleDateFormat.format(t));
|
120
|
+
|
63
|
-
}
|
121
|
+
}
|
122
|
+
|
123
|
+
};
|
64
124
|
|
65
125
|
|
66
126
|
|
67
127
|
|
68
|
-
|
69
|
-
public void get_12(){
|
70
|
-
|
71
|
-
Intent intent = new Intent(this,Result.class);
|
72
|
-
|
73
|
-
intent.putExtra(SCORE,score);
|
74
|
-
|
75
|
-
startActivity(intent);
|
76
|
-
|
77
|
-
}
|
78
128
|
|
79
129
|
}
|
80
130
|
|