質問編集履歴
2
誤字修正、Answer.javaの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -153,7 +153,87 @@
|
|
153
153
|
|
154
154
|
}
|
155
155
|
```
|
156
|
+
Answer.java
|
157
|
+
```
|
158
|
+
public class Answer extends AppCompatActivity {
|
156
159
|
|
160
|
+
private Button back;
|
161
|
+
private Button next;
|
162
|
+
|
163
|
+
//MainActivityから読み込み
|
164
|
+
Intent intent = getIntent();
|
165
|
+
public int i = intent.getIntExtra("i",0);
|
166
|
+
public int ans = intent.getIntExtra("ans",0);
|
167
|
+
public int count = intent.getIntExtra("count",0);
|
168
|
+
public int backcount = intent.getIntExtra("backcount",0);
|
169
|
+
public int prob = intent.getIntExtra("prob",5);
|
170
|
+
|
171
|
+
@Override
|
172
|
+
protected void onCreate(Bundle savedInstanceState) {
|
173
|
+
super.onCreate(savedInstanceState);
|
174
|
+
setContentView(R.layout.activity_answer);
|
175
|
+
|
176
|
+
getId();
|
177
|
+
|
178
|
+
showAnswer();
|
179
|
+
}
|
180
|
+
|
181
|
+
public void getId(){
|
182
|
+
back = findViewById(R.id.BackButton);
|
183
|
+
next = findViewById(R.id.NextButton);
|
184
|
+
}
|
185
|
+
|
186
|
+
public void showAnswer(){
|
187
|
+
|
188
|
+
ImageView Answer_picture = findViewById(R.id.Answer_picture);
|
189
|
+
AssetManager assets = getResources().getAssets();
|
190
|
+
|
191
|
+
if(ans == 0){
|
192
|
+
//正解時
|
193
|
+
Answer_picture.setImageResource(R.drawable.maru);
|
194
|
+
}else{
|
195
|
+
//不正解
|
196
|
+
Answer_picture.setImageResource(R.drawable.batsu);
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
}
|
201
|
+
|
202
|
+
public void onNext(View view){
|
203
|
+
|
204
|
+
if(i == prob-1){
|
205
|
+
|
206
|
+
Intent intent = new Intent(Answer.this,result.class);
|
207
|
+
|
208
|
+
//Resultに送る変数
|
209
|
+
intent.putExtra("count",count);
|
210
|
+
intent.putExtra("backcount",backcount);
|
211
|
+
intent.putExtra("prob",prob);
|
212
|
+
|
213
|
+
startActivity(intent);
|
214
|
+
|
215
|
+
}else{
|
216
|
+
i++;
|
217
|
+
|
218
|
+
Intent intent = new Intent(Answer.this,MainActivity.class);
|
219
|
+
|
220
|
+
//MainActivityに送る変数
|
221
|
+
intent.putExtra("i",i);
|
222
|
+
intent.putExtra("count",count);
|
223
|
+
intent.putExtra("backcount",backcount);
|
224
|
+
|
225
|
+
startActivity(intent);
|
226
|
+
}
|
227
|
+
finish();
|
228
|
+
}
|
229
|
+
|
230
|
+
public void onBack(View view){
|
231
|
+
|
232
|
+
backcount++;
|
233
|
+
finish();
|
234
|
+
}
|
235
|
+
```
|
236
|
+
|
157
237
|
### 試したこと
|
158
238
|
|
159
239
|
manifest.xml
|
1
誤字修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,8 +42,7 @@
|
|
42
42
|
```
|
43
43
|
|
44
44
|
### 該当のソースコード
|
45
|
-
|
46
|
-
|
45
|
+
StartMenu.java
|
47
46
|
```
|
48
47
|
public class StartMenu extends AppCompatActivity {
|
49
48
|
|
@@ -59,7 +58,7 @@
|
|
59
58
|
}
|
60
59
|
}
|
61
60
|
```
|
62
|
-
|
61
|
+
MainActivity.java
|
63
62
|
```
|
64
63
|
public class MainActivity extends AppCompatActivity {
|
65
64
|
|