質問編集履歴
2
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,6 +32,106 @@
|
|
32
32
|
|
33
33
|
```ここに言語を入力
|
34
34
|
|
35
|
+
|
36
|
+
|
37
|
+
public class Keisan extends Activity implements View.OnClickListener {
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
/**
|
42
|
+
|
43
|
+
* Buttonの配列
|
44
|
+
|
45
|
+
*/
|
46
|
+
|
47
|
+
Button mButton[];
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
/**
|
52
|
+
|
53
|
+
* Idの配列
|
54
|
+
|
55
|
+
*/
|
56
|
+
|
57
|
+
int mId[] = {R.id.btn0, R.id.btn1, R.id.btn2, R.id.btn3,
|
58
|
+
|
59
|
+
R.id.btn4, R.id.btn5, R.id.btn6, R.id.btn7,
|
60
|
+
|
61
|
+
R.id.btn8, R.id.btn9, R.id.clearbtn};
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
/**
|
66
|
+
|
67
|
+
* キー
|
68
|
+
|
69
|
+
*/
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
private final int KEY_EQUAL = 12;
|
74
|
+
|
75
|
+
private final int KEY_CLEAR = 14;
|
76
|
+
|
77
|
+
/**
|
78
|
+
|
79
|
+
* TextView
|
80
|
+
|
81
|
+
*/
|
82
|
+
|
83
|
+
private TextView mTextView;
|
84
|
+
|
85
|
+
private TextView mAnswer;
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
private TextView qa1;
|
90
|
+
|
91
|
+
private TextView qa2;
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
private int n;
|
96
|
+
|
97
|
+
private int m;
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
/**
|
102
|
+
|
103
|
+
* 答えのリスト
|
104
|
+
|
105
|
+
*/
|
106
|
+
|
107
|
+
private String[] answers = new String[4];
|
108
|
+
|
109
|
+
/**
|
110
|
+
|
111
|
+
* 前の処理
|
112
|
+
|
113
|
+
*/
|
114
|
+
|
115
|
+
private int beforeStatus = 0;
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
/**
|
120
|
+
|
121
|
+
* 計算中の値
|
122
|
+
|
123
|
+
*/
|
124
|
+
|
125
|
+
private ArrayList<String> calcArray;
|
126
|
+
|
127
|
+
/**
|
128
|
+
|
129
|
+
* 計算する時の配列
|
130
|
+
|
131
|
+
*/
|
132
|
+
|
133
|
+
private ArrayList<String> signArray;
|
134
|
+
|
35
135
|
|
36
136
|
|
37
137
|
@Override
|
@@ -282,11 +382,7 @@
|
|
282
382
|
|
283
383
|
private String checkDisplay(String now) {
|
284
384
|
|
285
|
-
if (beforeStatus == KEY_PLUS
|
286
|
-
|
287
|
-
|| beforeStatus == KEY_MINUS
|
288
|
-
|
289
|
-
|
385
|
+
if (beforeStatus == KEY_EQUAL) {
|
290
386
|
|
291
387
|
mTextView.setText("");
|
292
388
|
|
1
参考コードのURL追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -431,3 +431,9 @@
|
|
431
431
|
}
|
432
432
|
|
433
433
|
```
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
参考にしたコード
|
438
|
+
|
439
|
+
https://github.com/gcluelabs/DentakuQuiz001/blob/master/src/com/example/dentaku/Dentaku.java
|