質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
よろしくお願いします。
|
6
6
|
|
7
|
-
|
8
|
-
|
9
7
|
```
|
10
8
|
|
11
9
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
@@ -20,8 +18,6 @@
|
|
20
18
|
|
21
19
|
android:paddingTop="10dp">
|
22
20
|
|
23
|
-
|
24
|
-
|
25
21
|
<ImageView
|
26
22
|
|
27
23
|
android:id="@+id/list1"
|
@@ -34,11 +30,11 @@
|
|
34
30
|
|
35
31
|
android:src="@drawable/1"/>
|
36
32
|
|
37
|
-
|
33
|
+
//省略
|
38
34
|
|
39
35
|
<ImageView
|
40
36
|
|
41
|
-
android:id="@+id/list
|
37
|
+
android:id="@+id/list13"
|
42
38
|
|
43
39
|
android:layout_width="0dp"
|
44
40
|
|
@@ -48,210 +44,22 @@
|
|
48
44
|
|
49
45
|
android:src="@drawable/1"/>
|
50
46
|
|
51
|
-
|
52
|
-
|
53
|
-
<ImageView
|
54
|
-
|
55
|
-
android:id="@+id/list3"
|
56
|
-
|
57
|
-
android:layout_width="0dp"
|
58
|
-
|
59
|
-
android:layout_height="wrap_content"
|
60
|
-
|
61
|
-
android:layout_weight="1"
|
62
|
-
|
63
|
-
android:src="@drawable/1"/>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<ImageView
|
70
|
-
|
71
|
-
android:id="@+id/list4"
|
72
|
-
|
73
|
-
android:layout_width="0dp"
|
74
|
-
|
75
|
-
android:layout_height="wrap_content"
|
76
|
-
|
77
|
-
android:layout_weight="1"
|
78
|
-
|
79
|
-
android:src="@drawable/1"/>
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
<ImageView
|
86
|
-
|
87
|
-
android:id="@+id/list5"
|
88
|
-
|
89
|
-
android:layout_width="0dp"
|
90
|
-
|
91
|
-
android:layout_height="wrap_content"
|
92
|
-
|
93
|
-
android:layout_weight="1"
|
94
|
-
|
95
|
-
android:src="@drawable/1"/>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<ImageView
|
102
|
-
|
103
|
-
android:id="@+id/list6"
|
104
|
-
|
105
|
-
android:layout_width="0dp"
|
106
|
-
|
107
|
-
android:layout_height="wrap_content"
|
108
|
-
|
109
|
-
android:layout_weight="1"
|
110
|
-
|
111
|
-
android:src="@drawable/1"/>
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
<ImageView
|
118
|
-
|
119
|
-
android:id="@+id/list7"
|
120
|
-
|
121
|
-
android:layout_width="0dp"
|
122
|
-
|
123
|
-
android:layout_height="wrap_content"
|
124
|
-
|
125
|
-
android:layout_weight="1"
|
126
|
-
|
127
|
-
android:src="@drawable/1"/>
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<ImageView
|
134
|
-
|
135
|
-
android:id="@+id/list8"
|
136
|
-
|
137
|
-
android:layout_width="0dp"
|
138
|
-
|
139
|
-
android:layout_height="wrap_content"
|
140
|
-
|
141
|
-
android:layout_weight="1"
|
142
|
-
|
143
|
-
android:src="@drawable/1"/>
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
<ImageView
|
150
|
-
|
151
|
-
android:id="@+id/list9"
|
152
|
-
|
153
|
-
android:layout_width="0dp"
|
154
|
-
|
155
|
-
android:layout_height="wrap_content"
|
156
|
-
|
157
|
-
android:layout_weight="1"
|
158
|
-
|
159
|
-
android:src="@drawable/1"/>
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
<ImageView
|
166
|
-
|
167
|
-
android:id="@+id/list10"
|
168
|
-
|
169
|
-
android:layout_width="0dp"
|
170
|
-
|
171
|
-
android:layout_height="wrap_content"
|
172
|
-
|
173
|
-
android:layout_weight="1"
|
174
|
-
|
175
|
-
android:src="@drawable/1"/>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
<ImageView
|
182
|
-
|
183
|
-
android:id="@+id/list11"
|
184
|
-
|
185
|
-
android:layout_width="0dp"
|
186
|
-
|
187
|
-
android:layout_height="wrap_content"
|
188
|
-
|
189
|
-
android:layout_weight="1"
|
190
|
-
|
191
|
-
android:src="@drawable/1"/>
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
<ImageView
|
198
|
-
|
199
|
-
android:id="@+id/list12"
|
200
|
-
|
201
|
-
android:layout_width="0dp"
|
202
|
-
|
203
|
-
android:layout_height="wrap_content"
|
204
|
-
|
205
|
-
android:layout_weight="1"
|
206
|
-
|
207
|
-
android:src="@drawable/1"/>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
<ImageView
|
214
|
-
|
215
|
-
android:id="@+id/list13"
|
216
|
-
|
217
|
-
android:layout_width="0dp"
|
218
|
-
|
219
|
-
android:layout_height="wrap_content"
|
220
|
-
|
221
|
-
android:layout_weight="1"
|
222
|
-
|
223
|
-
android:src="@drawable/1"/>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
47
|
</LinearLayout>
|
230
48
|
|
231
49
|
コード
|
232
50
|
|
233
51
|
```
|
234
52
|
|
235
|
-
|
236
|
-
|
237
53
|
```
|
238
54
|
|
239
55
|
import android.widget.ImageView;
|
240
56
|
|
241
|
-
|
242
|
-
|
243
57
|
public class ListItem {
|
244
58
|
|
245
|
-
|
246
|
-
|
247
59
|
private int ListId;
|
248
60
|
|
249
|
-
|
250
|
-
|
251
61
|
private ImageView imageView1;
|
252
62
|
|
253
|
-
|
254
|
-
|
255
63
|
private int imageId1;
|
256
64
|
|
257
65
|
private int imageId2;
|
@@ -280,199 +88,21 @@
|
|
280
88
|
|
281
89
|
|
282
90
|
|
283
|
-
|
284
|
-
|
285
91
|
public int getImageId1() {
|
286
92
|
|
287
93
|
return imageId1;
|
288
94
|
|
289
95
|
}
|
290
96
|
|
291
|
-
|
292
|
-
|
293
97
|
public void setImageId1(int imageId1) {
|
294
98
|
|
295
99
|
this.imageId1 = imageId1;
|
296
100
|
|
297
101
|
}
|
298
102
|
|
299
|
-
|
300
|
-
|
301
|
-
public int getImageId2() {
|
302
|
-
|
303
|
-
|
103
|
+
//省略
|
304
|
-
|
104
|
+
|
305
|
-
}
|
105
|
+
}
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
public void setImageId2(int imageId2) {
|
310
|
-
|
311
|
-
this.imageId2 = imageId2;
|
312
|
-
|
313
|
-
}
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
public int getImageId3() {
|
318
|
-
|
319
|
-
return imageId3;
|
320
|
-
|
321
|
-
}
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
public void setImageId3(int imageId3) {
|
326
|
-
|
327
|
-
this.imageId3 = imageId3;
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
public int getImageId4() {
|
334
|
-
|
335
|
-
return imageId4;
|
336
|
-
|
337
|
-
}
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
public void setImageId4(int imageId4) {
|
342
|
-
|
343
|
-
this.imageId4 = imageId4;
|
344
|
-
|
345
|
-
}
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
public int getImageId5() {
|
350
|
-
|
351
|
-
return imageId5;
|
352
|
-
|
353
|
-
}
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
public void setImageId5(int imageId5) {
|
358
|
-
|
359
|
-
this.imageId5 = imageId5;
|
360
|
-
|
361
|
-
}
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
public int getImageId6() {
|
366
|
-
|
367
|
-
return imageId6;
|
368
|
-
|
369
|
-
}
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
public void setImageId6(int imageId6) {
|
374
|
-
|
375
|
-
this.imageId6 = imageId6;
|
376
|
-
|
377
|
-
}
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
public int getImageId7() {
|
382
|
-
|
383
|
-
return imageId7;
|
384
|
-
|
385
|
-
}
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
public void setImageId7(int imageId7) {
|
390
|
-
|
391
|
-
this.imageId7 = imageId7;
|
392
|
-
|
393
|
-
}
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
public int getImageId8() {
|
398
|
-
|
399
|
-
return imageId8;
|
400
|
-
|
401
|
-
}
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
public void setImageId8(int imageId8) {
|
406
|
-
|
407
|
-
this.imageId8 = imageId8;
|
408
|
-
|
409
|
-
}
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
public int getImageId9() {
|
414
|
-
|
415
|
-
return imageId9;
|
416
|
-
|
417
|
-
}
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
public void setImageId9(int imageId9) {
|
422
|
-
|
423
|
-
this.imageId9 = imageId9;
|
424
|
-
|
425
|
-
}
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
public int getImageId10() {
|
430
|
-
|
431
|
-
return imageId10;
|
432
|
-
|
433
|
-
}
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
public void setImageId10(int imageId10) {
|
438
|
-
|
439
|
-
this.imageId10 = imageId10;
|
440
|
-
|
441
|
-
}
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
public int getImageId11() {
|
446
|
-
|
447
|
-
return imageId11;
|
448
|
-
|
449
|
-
}
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
public void setImageId11(int imageId11) {
|
454
|
-
|
455
|
-
this.imageId11 = imageId11;
|
456
|
-
|
457
|
-
}
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
public int getImageId12() {
|
462
|
-
|
463
|
-
return imageId12;
|
464
|
-
|
465
|
-
}
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
public void setImageId12(int imageId12) {
|
470
|
-
|
471
|
-
this.imageId12 = imageId12;
|
472
|
-
|
473
|
-
}
|
474
|
-
|
475
|
-
|
476
106
|
|
477
107
|
public int getImageId13() {
|
478
108
|
|
@@ -480,8 +110,6 @@
|
|
480
110
|
|
481
111
|
}
|
482
112
|
|
483
|
-
|
484
|
-
|
485
113
|
public void setImageId13(int imageId13) {
|
486
114
|
|
487
115
|
this.imageId13 = imageId13;
|
@@ -490,8 +118,6 @@
|
|
490
118
|
|
491
119
|
}
|
492
120
|
|
493
|
-
|
494
|
-
|
495
121
|
コード
|
496
122
|
|
497
123
|
```
|
@@ -514,16 +140,10 @@
|
|
514
140
|
|
515
141
|
import android.widget.ImageView;
|
516
142
|
|
517
|
-
|
518
|
-
|
519
143
|
import java.util.ArrayList;
|
520
144
|
|
521
|
-
|
522
|
-
|
523
145
|
public class ListArrayAdapter extends ArrayAdapter<ListItem>{
|
524
146
|
|
525
|
-
|
526
|
-
|
527
147
|
private LayoutInflater layoutInflater;
|
528
148
|
|
529
149
|
public ListArrayAdapter(Context c, int id, ArrayList<ListItem> listItems){
|
@@ -534,8 +154,6 @@
|
|
534
154
|
|
535
155
|
}
|
536
156
|
|
537
|
-
|
538
|
-
|
539
157
|
@Override
|
540
158
|
|
541
159
|
public View getView(int pos, View convertView, ViewGroup parent){
|
@@ -546,12 +164,8 @@
|
|
546
164
|
|
547
165
|
}
|
548
166
|
|
549
|
-
|
550
|
-
|
551
167
|
ListItem listItem =(ListItem)getItem(pos);
|
552
168
|
|
553
|
-
|
554
|
-
|
555
169
|
((ImageView) convertView.findViewById(R.id.list1)).setImageResource(listItem.getImageId1());
|
556
170
|
|
557
171
|
((ImageView) convertView.findViewById(R.id.list2)).setImageResource(listItem.getImageId2());
|
@@ -578,8 +192,6 @@
|
|
578
192
|
|
579
193
|
((ImageView) convertView.findViewById(R.id.list13)).setImageResource(listItem.getImageId13());
|
580
194
|
|
581
|
-
|
582
|
-
|
583
195
|
return convertView;
|
584
196
|
|
585
197
|
}
|
@@ -589,3 +201,159 @@
|
|
589
201
|
コード
|
590
202
|
|
591
203
|
```
|
204
|
+
|
205
|
+
```
|
206
|
+
|
207
|
+
public void setQuestion() {
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
ListView listView = new ListView(this);
|
212
|
+
|
213
|
+
ArrayList<ListItem> items = new ArrayList<>();
|
214
|
+
|
215
|
+
ListItem listItem = new ListItem();
|
216
|
+
|
217
|
+
int[] list1 = new int[100];
|
218
|
+
|
219
|
+
int[] list2 = new int[100];
|
220
|
+
|
221
|
+
int[] list3 = new int[100];
|
222
|
+
|
223
|
+
int[] list4 = new int[100];
|
224
|
+
|
225
|
+
int[] list5 = new int[100];
|
226
|
+
|
227
|
+
int[] list6 = new int[100];
|
228
|
+
|
229
|
+
int[] list7 = new int[100];
|
230
|
+
|
231
|
+
int[] list8 = new int[100];
|
232
|
+
|
233
|
+
int[] list9 = new int[100];
|
234
|
+
|
235
|
+
int[] list10 = new int[100];
|
236
|
+
|
237
|
+
int[] list11 = new int[100];
|
238
|
+
|
239
|
+
int[] list12 = new int[100];
|
240
|
+
|
241
|
+
int[] list13 = new int[100];
|
242
|
+
|
243
|
+
for (int i = 0; i < 100; i++) {
|
244
|
+
|
245
|
+
QuizOpenHelper quizOpenHelper = new QuizOpenHelper(this);
|
246
|
+
|
247
|
+
SQLiteDatabase sqLiteDatabase = quizOpenHelper.getReadableDatabase();
|
248
|
+
|
249
|
+
quizNo = i + 1;
|
250
|
+
|
251
|
+
String sql = "select abc1,abc2,abc3,abc4,abc5,abc6,abc7,abc8,abc9,abc10,abc11,abc12,abc13 from quiz where _id =" + quizNo;
|
252
|
+
|
253
|
+
Cursor cursor = sqLiteDatabase.rawQuery(sql, null);
|
254
|
+
|
255
|
+
cursor.moveToFirst();
|
256
|
+
|
257
|
+
abc1 = cursor.getInt(cursor.getColumnIndex("abc1"));
|
258
|
+
|
259
|
+
abc2 = cursor.getInt(cursor.getColumnIndex("abc2"));
|
260
|
+
|
261
|
+
abc3 = cursor.getInt(cursor.getColumnIndex("abc3"));
|
262
|
+
|
263
|
+
abc4 = cursor.getInt(cursor.getColumnIndex("abc4"));
|
264
|
+
|
265
|
+
abc5 = cursor.getInt(cursor.getColumnIndex("abc5"));
|
266
|
+
|
267
|
+
abc6 = cursor.getInt(cursor.getColumnIndex("abc6"));
|
268
|
+
|
269
|
+
abc7 = cursor.getInt(cursor.getColumnIndex("abc7"));
|
270
|
+
|
271
|
+
abc8 = cursor.getInt(cursor.getColumnIndex("abc8"));
|
272
|
+
|
273
|
+
abc9 = cursor.getInt(cursor.getColumnIndex("abc9"));
|
274
|
+
|
275
|
+
abc10 = cursor.getInt(cursor.getColumnIndex("abc10"));
|
276
|
+
|
277
|
+
abc11 = cursor.getInt(cursor.getColumnIndex("abc11"));
|
278
|
+
|
279
|
+
abc12 = cursor.getInt(cursor.getColumnIndex("abc12"));
|
280
|
+
|
281
|
+
abc13 = cursor.getInt(cursor.getColumnIndex("abc13"));
|
282
|
+
|
283
|
+
switch (abc1) {
|
284
|
+
|
285
|
+
case 1:
|
286
|
+
|
287
|
+
list1[i] = R.drawable.a1;
|
288
|
+
|
289
|
+
break;
|
290
|
+
|
291
|
+
case 2:
|
292
|
+
|
293
|
+
break;
|
294
|
+
|
295
|
+
list1[i] = R.drawable.a2;
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
switch (abc2) {
|
300
|
+
|
301
|
+
case 1:
|
302
|
+
|
303
|
+
list2[i] = R.drawable.a1;
|
304
|
+
|
305
|
+
break;
|
306
|
+
|
307
|
+
case 2:
|
308
|
+
|
309
|
+
list2[i] = R.drawable.a2;
|
310
|
+
|
311
|
+
break;
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
//省略
|
316
|
+
|
317
|
+
listItem.setImageId1(list1[i]);
|
318
|
+
|
319
|
+
listItem.setImageId2(list2[i]);
|
320
|
+
|
321
|
+
listItem.setImageId3(list3[i]);
|
322
|
+
|
323
|
+
listItem.setImageId4(list4[i]);
|
324
|
+
|
325
|
+
listItem.setImageId5(list5[i]);
|
326
|
+
|
327
|
+
listItem.setImageId6(list6[i]);
|
328
|
+
|
329
|
+
listItem.setImageId7(list7[i]);
|
330
|
+
|
331
|
+
listItem.setImageId8(list8[i]);
|
332
|
+
|
333
|
+
listItem.setImageId9(list9[i]);
|
334
|
+
|
335
|
+
listItem.setImageId10(list10[i]);
|
336
|
+
|
337
|
+
listItem.setImageId11(list11[i]);
|
338
|
+
|
339
|
+
listItem.setImageId12(list12[i]);
|
340
|
+
|
341
|
+
listItem.setImageId13(list13[i]);
|
342
|
+
|
343
|
+
items.add(listItem);
|
344
|
+
|
345
|
+
}
|
346
|
+
|
347
|
+
ListArrayAdapter listArrayAdapter = new ListArrayAdapter(this ,0, items);
|
348
|
+
|
349
|
+
listView.setAdapter(listArrayAdapter);
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
コード
|
358
|
+
|
359
|
+
```
|