質問編集履歴
68
title
CHANGED
File without changes
|
body
CHANGED
@@ -139,7 +139,7 @@
|
|
139
139
|
case (R.id.button3):
|
140
140
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
141
141
|
break;
|
142
|
-
//4から9も同じ感じで
|
142
|
+
//4から9も同じ感じで
|
143
143
|
}
|
144
144
|
}
|
145
145
|
}
|
67
title
CHANGED
File without changes
|
body
CHANGED
@@ -111,34 +111,37 @@
|
|
111
111
|
button8.setBackgroundColor(y);
|
112
112
|
|
113
113
|
}
|
114
|
+
}
|
114
|
-
|
115
|
+
```
|
115
116
|
|
116
117
|
|
117
|
-
``
|
118
|
+
``//ここから悩んでる所です。``
|
118
119
|
|
120
|
+
```java:abr
|
119
121
|
class Click implements View.OnClickListener {
|
120
122
|
@Override
|
121
|
-
|
123
|
+
public void onClick(View v) {
|
122
124
|
int y=
|
123
|
-
getResources().getColor(R.color.y);
|
125
|
+
getResources().getColor(R.color.y);
|
124
126
|
int x=
|
125
|
-
getResources().getColor(R.color.x);
|
127
|
+
getResources().getColor(R.color.x);
|
126
128
|
|
127
|
-
|
129
|
+
switch (v.getId()) {
|
128
130
|
case (R.id.button):
|
129
|
-
//ここをif文とかで判定したい
|
131
|
+
//ここをif文とかで判定したい
|
130
132
|
Button button=
|
131
|
-
findViewById(R.id.button);
|
133
|
+
findViewById(R.id.button);
|
132
134
|
button2.setBackgroundColor(x);
|
133
|
-
//if(ここがわからない)
|
135
|
+
//if(ここがわからない)
|
134
|
-
|
136
|
+
break;
|
135
137
|
case (R.id.button2):
|
136
138
|
break;
|
137
139
|
case (R.id.button3):
|
138
140
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
139
|
-
|
141
|
+
break;
|
140
|
-
//4から9も同じ感じで```
|
142
|
+
//4から9も同じ感じで```
|
141
|
-
}
|
143
|
+
}
|
142
|
-
}
|
144
|
+
}
|
143
145
|
}
|
144
|
-
}
|
146
|
+
}
|
147
|
+
```
|
66
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,28 +42,28 @@
|
|
42
42
|
public class MainActivity extends AppCompatActivity {
|
43
43
|
|
44
44
|
@Override
|
45
|
-
protected void onCreate(Bundle
|
45
|
+
protected void onCreate(Bundle savedInstanceState) {
|
46
46
|
super.onCreate(savedInstanceState);
|
47
47
|
setContentView(R.layout.activity_main);
|
48
48
|
|
49
49
|
Button button_r =
|
50
|
-
findViewById(R.id.button_r);
|
50
|
+
findViewById(R.id.button_r);
|
51
51
|
button_r.setOnClickListener(new MyClickListener());
|
52
52
|
|
53
53
|
Button button1=
|
54
|
-
findViewById(R.id.button);
|
54
|
+
findViewById(R.id.button);
|
55
55
|
button1.setOnClickListener(new Click());
|
56
56
|
|
57
57
|
Button button2=
|
58
|
-
findViewById(R.id.button2);
|
58
|
+
findViewById(R.id.button2);
|
59
59
|
button2.setOnClickListener(new Click());
|
60
60
|
|
61
61
|
//3~8も同じ
|
62
62
|
|
63
63
|
|
64
64
|
Button button9=
|
65
|
-
findViewById(R.id.button9);
|
65
|
+
findViewById(R.id.button9);
|
66
|
-
button9.setOnClickListener(new Click());
|
66
|
+
button9.setOnClickListener(new Click());
|
67
67
|
}
|
68
68
|
```
|
69
69
|
|
@@ -77,39 +77,40 @@
|
|
77
77
|
Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show();
|
78
78
|
|
79
79
|
Button button=
|
80
|
-
findViewById(R.id.button);
|
80
|
+
findViewById(R.id.button);
|
81
81
|
Button button1=
|
82
|
-
findViewById(R.id.button2);
|
82
|
+
findViewById(R.id.button2);
|
83
83
|
Button button2=
|
84
|
-
findViewById(R.id.button3);
|
84
|
+
findViewById(R.id.button3);
|
85
85
|
Button button3=
|
86
|
-
findViewById(R.id.button4);
|
86
|
+
findViewById(R.id.button4);
|
87
87
|
Button button4=
|
88
|
-
findViewById(R.id.button5);
|
88
|
+
findViewById(R.id.button5);
|
89
89
|
Button button5=
|
90
|
-
findViewById(R.id.button6);
|
90
|
+
findViewById(R.id.button6);
|
91
91
|
Button button6=
|
92
|
-
findViewById(R.id.button7);
|
92
|
+
findViewById(R.id.button7);
|
93
93
|
Button button7=
|
94
|
-
findViewById(R.id.button8);
|
94
|
+
findViewById(R.id.button8);
|
95
95
|
Button button8=
|
96
|
-
findViewById(R.id.button9);
|
96
|
+
findViewById(R.id.button9);
|
97
97
|
|
98
98
|
int y= getResources().getColor(R.color.y);
|
99
|
-
//R.color.xxx は name=”xxx”とした時
|
99
|
+
//R.color.xxx は name=”xxx”とした時
|
100
100
|
button.setBackgroundColor(y);
|
101
|
-
// view は変更対象の部品に適宜置き換える
|
101
|
+
// view は変更対象の部品に適宜置き換える
|
102
102
|
button1.setBackgroundColor(y);
|
103
|
-
// view は変更対象の部品に適宜置き換える
|
103
|
+
// view は変更対象の部品に適宜置き換える
|
104
|
+
button2.setBackgroundColor(y);
|
104
|
-
|
105
|
+
// view は変更対象の部品に適宜置き換える
|
105
|
-
|
106
|
+
button3.setBackgroundColor(y);
|
106
|
-
|
107
|
+
button4.setBackgroundColor(y);
|
107
|
-
|
108
|
+
button5.setBackgroundColor(y);
|
108
|
-
|
109
|
+
button6.setBackgroundColor(y);
|
109
|
-
|
110
|
+
button7.setBackgroundColor(y);
|
110
|
-
|
111
|
+
button8.setBackgroundColor(y);
|
111
112
|
|
112
|
-
}
|
113
|
+
}
|
113
114
|
}```
|
114
115
|
|
115
116
|
|
65
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,66 +38,70 @@
|
|
38
38
|
一応自分の作ってるやつ載せておきます。
|
39
39
|
|
40
40
|
|
41
|
+
```java:br
|
41
42
|
public class MainActivity extends AppCompatActivity {
|
42
43
|
|
43
44
|
@Override
|
44
|
-
|
45
|
+
protected void onCreate(Bundle savedInstanceState) {
|
45
|
-
|
46
|
+
super.onCreate(savedInstanceState);
|
46
|
-
|
47
|
+
setContentView(R.layout.activity_main);
|
47
48
|
|
48
|
-
|
49
|
+
Button button_r =
|
49
50
|
findViewById(R.id.button_r);
|
50
|
-
button_r.setOnClickListener(new MyClickListener());
|
51
|
+
button_r.setOnClickListener(new MyClickListener());
|
51
52
|
|
52
|
-
|
53
|
+
Button button1=
|
53
54
|
findViewById(R.id.button);
|
54
|
-
button1.setOnClickListener(new Click());
|
55
|
+
button1.setOnClickListener(new Click());
|
55
56
|
|
56
|
-
|
57
|
+
Button button2=
|
57
58
|
findViewById(R.id.button2);
|
58
|
-
button2.setOnClickListener(new Click());
|
59
|
+
button2.setOnClickListener(new Click());
|
59
60
|
|
60
61
|
//3~8も同じ
|
61
62
|
|
62
63
|
|
63
|
-
|
64
|
+
Button button9=
|
64
65
|
findViewById(R.id.button9);
|
65
|
-
button9.setOnClickListener(new Click());
|
66
|
+
button9.setOnClickListener(new Click());
|
67
|
+
}
|
66
|
-
|
68
|
+
```
|
67
69
|
|
68
70
|
|
69
|
-
``
|
71
|
+
``//ここはリセットなのできにしないで``
|
72
|
+
|
73
|
+
```java:rb
|
70
74
|
class MyClickListener implements View.OnClickListener {
|
71
75
|
@Override
|
72
|
-
|
76
|
+
public void onClick(View v) {
|
73
|
-
|
77
|
+
Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show();
|
74
78
|
|
75
|
-
|
79
|
+
Button button=
|
76
|
-
findViewById(R.id.button);
|
80
|
+
findViewById(R.id.button);
|
77
|
-
|
81
|
+
Button button1=
|
78
|
-
findViewById(R.id.button2);
|
82
|
+
findViewById(R.id.button2);
|
79
|
-
|
83
|
+
Button button2=
|
80
|
-
findViewById(R.id.button3);
|
84
|
+
findViewById(R.id.button3);
|
81
|
-
|
85
|
+
Button button3=
|
82
|
-
findViewById(R.id.button4);
|
86
|
+
findViewById(R.id.button4);
|
83
|
-
|
87
|
+
Button button4=
|
84
|
-
findViewById(R.id.button5);
|
88
|
+
findViewById(R.id.button5);
|
85
|
-
|
89
|
+
Button button5=
|
86
|
-
findViewById(R.id.button6);
|
90
|
+
findViewById(R.id.button6);
|
87
|
-
|
91
|
+
Button button6=
|
88
|
-
findViewById(R.id.button7);
|
92
|
+
findViewById(R.id.button7);
|
89
|
-
|
93
|
+
Button button7=
|
90
|
-
findViewById(R.id.button8);
|
94
|
+
findViewById(R.id.button8);
|
91
|
-
|
95
|
+
Button button8=
|
92
|
-
findViewById(R.id.button9);
|
96
|
+
findViewById(R.id.button9);
|
93
97
|
|
94
|
-
|
98
|
+
int y= getResources().getColor(R.color.y);
|
95
99
|
//R.color.xxx は name=”xxx”とした時
|
96
|
-
|
100
|
+
button.setBackgroundColor(y);
|
97
101
|
// view は変更対象の部品に適宜置き換える
|
98
|
-
|
102
|
+
button1.setBackgroundColor(y);
|
99
103
|
// view は変更対象の部品に適宜置き換える
|
100
|
-
|
104
|
+
button2.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
101
105
|
```button3.setBackgroundColor(y);```
|
102
106
|
```button4.setBackgroundColor(y);```
|
103
107
|
```button5.setBackgroundColor(y); ```
|
64
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
前提・実現したい
|
2
2
|
|
3
3
|
android studioで、3×3のボタンがあるんですが、そのボタンの1つを押すとそのボタンと上下左右のボタンの色が変える
|
4
|
-
ってやつをやりたいんですが、どうやったらいいですかね?
|
4
|
+
ってやつをやりたいんですが、どうやったらいいですかね?
|
5
5
|
色は2色でcolors.xmlでxとyって名前になってます。
|
6
6
|
|
7
7
|
一応ボタンの色がxの時はyにyの時はxにするって処理なんですが
|
63
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
前提・実現したい
|
2
2
|
|
3
3
|
android studioで、3×3のボタンがあるんですが、そのボタンの1つを押すとそのボタンと上下左右のボタンの色が変える
|
4
|
-
ってやつをやりたいんですが、どうやったらいいですかね?
|
4
|
+
ってやつをやりたいんですが、どうやったらいいですかね?
|
5
5
|
色は2色でcolors.xmlでxとyって名前になってます。
|
6
6
|
|
7
7
|
一応ボタンの色がxの時はyにyの時はxにするって処理なんですが
|
62
title
CHANGED
File without changes
|
body
CHANGED
@@ -132,7 +132,7 @@
|
|
132
132
|
case (R.id.button3):
|
133
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
134
|
break;
|
135
|
-
//4から9も同じ感じで
|
135
|
+
//4から9も同じ感じで```
|
136
136
|
}```
|
137
137
|
}```
|
138
138
|
}
|
61
title
CHANGED
File without changes
|
body
CHANGED
@@ -114,7 +114,7 @@
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
|
-
|
117
|
+
int y=
|
118
118
|
getResources().getColor(R.color.y);
|
119
119
|
int x=
|
120
120
|
getResources().getColor(R.color.x);
|
@@ -132,7 +132,7 @@
|
|
132
132
|
case (R.id.button3):
|
133
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
134
|
break;
|
135
|
-
//4から9も同じ感じで
|
135
|
+
//4から9も同じ感じで
|
136
136
|
}```
|
137
137
|
}```
|
138
138
|
}
|
60
title
CHANGED
File without changes
|
body
CHANGED
@@ -115,9 +115,9 @@
|
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
117
|
```int y=
|
118
|
-
getResources().getColor(R.color.y);
|
118
|
+
getResources().getColor(R.color.y);
|
119
|
-
|
119
|
+
int x=
|
120
|
-
getResources().getColor(R.color.x);
|
120
|
+
getResources().getColor(R.color.x);
|
121
121
|
|
122
122
|
```switch (v.getId()) {
|
123
123
|
case (R.id.button):
|
59
title
CHANGED
File without changes
|
body
CHANGED
@@ -133,7 +133,7 @@
|
|
133
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
134
|
break;
|
135
135
|
//4から9も同じ感じで```
|
136
|
-
}
|
136
|
+
}```
|
137
137
|
}```
|
138
138
|
}
|
139
139
|
}
|
58
title
CHANGED
File without changes
|
body
CHANGED
@@ -115,11 +115,11 @@
|
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
117
|
```int y=
|
118
|
-
getResources().getColor(R.color.y);
|
118
|
+
getResources().getColor(R.color.y);```
|
119
|
-
int x=
|
119
|
+
```int x=
|
120
120
|
getResources().getColor(R.color.x);```
|
121
121
|
|
122
|
-
switch (v.getId()) {
|
122
|
+
```switch (v.getId()) {
|
123
123
|
case (R.id.button):
|
124
124
|
//ここをif文とかで判定したい
|
125
125
|
Button button=
|
@@ -132,7 +132,7 @@
|
|
132
132
|
case (R.id.button3):
|
133
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
134
|
break;
|
135
|
-
//4から9も同じ感じで
|
135
|
+
//4から9も同じ感じで```
|
136
136
|
}
|
137
137
|
}```
|
138
138
|
}
|
57
title
CHANGED
File without changes
|
body
CHANGED
@@ -114,13 +114,13 @@
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
|
-
int y=
|
117
|
+
```int y=
|
118
118
|
getResources().getColor(R.color.y);
|
119
119
|
int x=
|
120
120
|
getResources().getColor(R.color.x);```
|
121
121
|
|
122
122
|
switch (v.getId()) {
|
123
|
-
|
123
|
+
case (R.id.button):
|
124
124
|
//ここをif文とかで判定したい
|
125
125
|
Button button=
|
126
126
|
findViewById(R.id.button);
|
@@ -131,7 +131,7 @@
|
|
131
131
|
break;
|
132
132
|
case (R.id.button3):
|
133
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
|
-
break;
|
134
|
+
break;
|
135
135
|
//4から9も同じ感じで
|
136
136
|
}
|
137
137
|
}```
|
56
title
CHANGED
File without changes
|
body
CHANGED
@@ -120,7 +120,7 @@
|
|
120
120
|
getResources().getColor(R.color.x);```
|
121
121
|
|
122
122
|
switch (v.getId()) {
|
123
|
-
case (R.id.button):
|
123
|
+
```case (R.id.button):
|
124
124
|
//ここをif文とかで判定したい
|
125
125
|
Button button=
|
126
126
|
findViewById(R.id.button);
|
@@ -131,7 +131,7 @@
|
|
131
131
|
break;
|
132
132
|
case (R.id.button3):
|
133
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
|
-
break;
|
134
|
+
break;```
|
135
135
|
//4から9も同じ感じで
|
136
136
|
}
|
137
137
|
}```
|
55
title
CHANGED
File without changes
|
body
CHANGED
@@ -114,12 +114,12 @@
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
|
-
|
117
|
+
int y=
|
118
118
|
getResources().getColor(R.color.y);
|
119
119
|
int x=
|
120
120
|
getResources().getColor(R.color.x);```
|
121
121
|
|
122
|
-
|
122
|
+
switch (v.getId()) {
|
123
123
|
case (R.id.button):
|
124
124
|
//ここをif文とかで判定したい
|
125
125
|
Button button=
|
@@ -133,7 +133,7 @@
|
|
133
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
134
|
break;
|
135
135
|
//4から9も同じ感じで
|
136
|
-
}
|
136
|
+
}
|
137
137
|
}```
|
138
138
|
}
|
139
139
|
}
|
54
title
CHANGED
File without changes
|
body
CHANGED
@@ -113,11 +113,13 @@
|
|
113
113
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
|
-
```public void onClick(View v) {
|
116
|
+
```public void onClick(View v) {
|
117
|
+
```int y=
|
117
|
-
|
118
|
+
getResources().getColor(R.color.y);
|
119
|
+
int x=
|
118
|
-
|
120
|
+
getResources().getColor(R.color.x);```
|
119
121
|
|
120
|
-
switch (v.getId()) {
|
122
|
+
```switch (v.getId()) {
|
121
123
|
case (R.id.button):
|
122
124
|
//ここをif文とかで判定したい
|
123
125
|
Button button=
|
@@ -131,7 +133,7 @@
|
|
131
133
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
132
134
|
break;
|
133
135
|
//4から9も同じ感じで
|
134
|
-
}
|
135
|
-
|
136
|
+
}```
|
137
|
+
}```
|
136
138
|
}
|
137
139
|
}
|
53
title
CHANGED
File without changes
|
body
CHANGED
@@ -113,8 +113,8 @@
|
|
113
113
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
|
-
```public void onClick(View v) {
|
116
|
+
```public void onClick(View v) {```
|
117
|
-
|
117
|
+
int y= getResources().getColor(R.color.y);
|
118
118
|
int x= getResources().getColor(R.color.x);
|
119
119
|
|
120
120
|
switch (v.getId()) {
|
52
title
CHANGED
File without changes
|
body
CHANGED
@@ -132,6 +132,6 @@
|
|
132
132
|
break;
|
133
133
|
//4から9も同じ感じで
|
134
134
|
}
|
135
|
-
}```
|
135
|
+
```}```
|
136
136
|
}
|
137
137
|
}
|
51
title
CHANGED
File without changes
|
body
CHANGED
@@ -114,7 +114,7 @@
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
|
-
int y= getResources().getColor(R.color.y);
|
117
|
+
```int y= getResources().getColor(R.color.y);
|
118
118
|
int x= getResources().getColor(R.color.x);
|
119
119
|
|
120
120
|
switch (v.getId()) {
|
50
title
CHANGED
File without changes
|
body
CHANGED
@@ -114,14 +114,14 @@
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
|
-
|
117
|
+
int y= getResources().getColor(R.color.y);
|
118
118
|
int x= getResources().getColor(R.color.x);
|
119
119
|
|
120
120
|
switch (v.getId()) {
|
121
121
|
case (R.id.button):
|
122
122
|
//ここをif文とかで判定したい
|
123
|
-
Button
|
123
|
+
Button button=
|
124
|
-
|
124
|
+
findViewById(R.id.button);
|
125
125
|
button2.setBackgroundColor(x);
|
126
126
|
//if(ここがわからない)
|
127
127
|
break;
|
49
title
CHANGED
File without changes
|
body
CHANGED
@@ -114,24 +114,24 @@
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
116
|
```public void onClick(View v) {
|
117
|
-
```int y= getResources().getColor(R.color.y);
|
117
|
+
```int y= getResources().getColor(R.color.y);
|
118
|
-
|
118
|
+
int x= getResources().getColor(R.color.x);
|
119
119
|
|
120
|
-
|
120
|
+
switch (v.getId()) {
|
121
|
-
|
121
|
+
case (R.id.button):
|
122
122
|
//ここをif文とかで判定したい
|
123
123
|
Button
|
124
124
|
button=findViewById(R.id.button);
|
125
125
|
button2.setBackgroundColor(x);
|
126
126
|
//if(ここがわからない)
|
127
|
-
break;
|
127
|
+
break;
|
128
|
-
|
128
|
+
case (R.id.button2):
|
129
|
-
break;
|
129
|
+
break;
|
130
|
-
|
130
|
+
case (R.id.button3):
|
131
131
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
132
|
-
break;
|
132
|
+
break;
|
133
133
|
//4から9も同じ感じで
|
134
|
+
}
|
134
|
-
|
135
|
+
}```
|
135
|
-
}
|
136
136
|
}
|
137
137
|
}
|
48
title
CHANGED
File without changes
|
body
CHANGED
@@ -117,7 +117,7 @@
|
|
117
117
|
```int y= getResources().getColor(R.color.y);```
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
|
-
```switch (v.getId()) {
|
120
|
+
```switch (v.getId()) {```
|
121
121
|
```case (R.id.button):
|
122
122
|
//ここをif文とかで判定したい
|
123
123
|
Button
|
47
title
CHANGED
File without changes
|
body
CHANGED
@@ -132,6 +132,6 @@
|
|
132
132
|
break;```
|
133
133
|
//4から9も同じ感じで
|
134
134
|
}```
|
135
|
-
}
|
135
|
+
}
|
136
|
-
}
|
136
|
+
}
|
137
137
|
}
|
46
title
CHANGED
File without changes
|
body
CHANGED
@@ -133,5 +133,5 @@
|
|
133
133
|
//4から9も同じ感じで
|
134
134
|
}```
|
135
135
|
}```
|
136
|
-
}
|
136
|
+
}```
|
137
137
|
}
|
45
title
CHANGED
File without changes
|
body
CHANGED
@@ -118,18 +118,18 @@
|
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
|
-
```case (R.id.button):
|
121
|
+
```case (R.id.button):
|
122
122
|
//ここをif文とかで判定したい
|
123
|
-
|
123
|
+
Button
|
124
|
-
button=findViewById(R.id.button);
|
124
|
+
button=findViewById(R.id.button);
|
125
|
-
|
125
|
+
button2.setBackgroundColor(x);
|
126
126
|
//if(ここがわからない)
|
127
|
-
|
127
|
+
break;```
|
128
|
-
```case (R.id.button2):
|
128
|
+
```case (R.id.button2):
|
129
|
-
|
129
|
+
break;```
|
130
|
-
```case (R.id.button3):
|
130
|
+
```case (R.id.button3):
|
131
|
-
|
131
|
+
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
132
|
-
|
132
|
+
break;```
|
133
133
|
//4から9も同じ感じで
|
134
134
|
}```
|
135
135
|
}```
|
44
title
CHANGED
File without changes
|
body
CHANGED
@@ -118,26 +118,19 @@
|
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
|
-
```case (R.id.button):
|
121
|
+
```case (R.id.button):```
|
122
122
|
//ここをif文とかで判定したい
|
123
123
|
```Button
|
124
124
|
button=findViewById(R.id.button);```
|
125
125
|
```button2.setBackgroundColor(x);```
|
126
126
|
//if(ここがわからない)
|
127
|
-
//色を変える作業
|
128
|
-
//else
|
129
|
-
//色を変える作業
|
130
|
-
break;```
|
127
|
+
```break;```
|
131
|
-
```case (R.id.button2):
|
128
|
+
```case (R.id.button2):```
|
132
|
-
break;```
|
129
|
+
```break;```
|
133
|
-
```case (R.id.button3):
|
130
|
+
```case (R.id.button3):```
|
134
131
|
```Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
135
|
-
break;```
|
132
|
+
```break;```
|
136
|
-
//4から
|
133
|
+
//4から9も同じ感じで
|
137
|
-
|
138
|
-
```case (R.id.button9):
|
139
|
-
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
140
|
-
break;```
|
141
134
|
}```
|
142
135
|
}```
|
143
136
|
}
|
43
title
CHANGED
File without changes
|
body
CHANGED
@@ -131,13 +131,13 @@
|
|
131
131
|
```case (R.id.button2):
|
132
132
|
break;```
|
133
133
|
```case (R.id.button3):
|
134
|
-
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
134
|
+
```Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
135
|
-
|
135
|
+
break;```
|
136
136
|
//4から8も同じ感じで
|
137
137
|
|
138
138
|
```case (R.id.button9):
|
139
139
|
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
140
|
-
|
140
|
+
break;```
|
141
141
|
}```
|
142
142
|
}```
|
143
143
|
}
|
42
title
CHANGED
File without changes
|
body
CHANGED
@@ -118,7 +118,7 @@
|
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
|
-
```case (R.id.button):
|
121
|
+
```case (R.id.button):
|
122
122
|
//ここをif文とかで判定したい
|
123
123
|
```Button
|
124
124
|
button=findViewById(R.id.button);```
|
@@ -127,7 +127,7 @@
|
|
127
127
|
//色を変える作業
|
128
128
|
//else
|
129
129
|
//色を変える作業
|
130
|
-
|
130
|
+
break;```
|
131
131
|
```case (R.id.button2):
|
132
132
|
break;```
|
133
133
|
```case (R.id.button3):
|
41
title
CHANGED
File without changes
|
body
CHANGED
@@ -118,15 +118,15 @@
|
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
|
-
```case (R.id.button):
|
121
|
+
```case (R.id.button):```
|
122
122
|
//ここをif文とかで判定したい
|
123
|
-
Button
|
123
|
+
```Button
|
124
124
|
button=findViewById(R.id.button);```
|
125
125
|
```button2.setBackgroundColor(x);```
|
126
|
-
|
126
|
+
//if(ここがわからない)
|
127
|
-
|
127
|
+
//色を変える作業
|
128
|
-
|
128
|
+
//else
|
129
|
-
|
129
|
+
//色を変える作業
|
130
130
|
```break;```
|
131
131
|
```case (R.id.button2):
|
132
132
|
break;```
|
40
title
CHANGED
File without changes
|
body
CHANGED
@@ -140,5 +140,5 @@
|
|
140
140
|
```break;```
|
141
141
|
}```
|
142
142
|
}```
|
143
|
-
|
143
|
+
}
|
144
|
-
|
144
|
+
}
|
39
title
CHANGED
File without changes
|
body
CHANGED
@@ -123,17 +123,16 @@
|
|
123
123
|
Button
|
124
124
|
button=findViewById(R.id.button);```
|
125
125
|
```button2.setBackgroundColor(x);```
|
126
|
-
```//if(ここがわからない)
|
126
|
+
```//if(ここがわからない)```
|
127
|
-
//色を変える作業
|
127
|
+
```//色を変える作業```
|
128
|
-
//
|
128
|
+
```//else```
|
129
|
-
//色を変える作業
|
129
|
+
```//色を変える作業```
|
130
|
-
//}
|
131
|
-
break;```
|
130
|
+
```break;```
|
132
131
|
```case (R.id.button2):
|
133
132
|
break;```
|
134
133
|
```case (R.id.button3):
|
135
134
|
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
136
|
-
break;```
|
135
|
+
```break;```
|
137
136
|
//4から8も同じ感じで
|
138
137
|
|
139
138
|
```case (R.id.button9):
|
38
title
CHANGED
File without changes
|
body
CHANGED
@@ -120,8 +120,9 @@
|
|
120
120
|
```switch (v.getId()) {
|
121
121
|
```case (R.id.button):
|
122
122
|
//ここをif文とかで判定したい
|
123
|
+
Button
|
123
|
-
|
124
|
+
button=findViewById(R.id.button);```
|
124
|
-
button2.setBackgroundColor(x);```
|
125
|
+
```button2.setBackgroundColor(x);```
|
125
126
|
```//if(ここがわからない){
|
126
127
|
//色を変える作業
|
127
128
|
//}else{
|
37
title
CHANGED
File without changes
|
body
CHANGED
@@ -118,25 +118,25 @@
|
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
|
-
```case (R.id.button):
|
121
|
+
```case (R.id.button):
|
122
|
-
|
122
|
+
//ここをif文とかで判定したい
|
123
|
-
|
123
|
+
Button button=findViewById(R.id.button);
|
124
124
|
button2.setBackgroundColor(x);```
|
125
125
|
```//if(ここがわからない){
|
126
126
|
//色を変える作業
|
127
127
|
//}else{
|
128
128
|
//色を変える作業
|
129
|
-
//}
|
129
|
+
//}
|
130
|
-
|
130
|
+
break;```
|
131
|
-
```case (R.id.button2):
|
131
|
+
```case (R.id.button2):
|
132
|
-
|
132
|
+
break;```
|
133
|
-
```case (R.id.button3):
|
133
|
+
```case (R.id.button3):
|
134
|
-
|
134
|
+
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
135
|
-
|
135
|
+
break;```
|
136
136
|
//4から8も同じ感じで
|
137
137
|
|
138
|
-
```case (R.id.button9):
|
138
|
+
```case (R.id.button9):
|
139
|
-
|
139
|
+
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
140
140
|
```break;```
|
141
141
|
}```
|
142
142
|
}```
|
36
title
CHANGED
File without changes
|
body
CHANGED
@@ -118,25 +118,25 @@
|
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
|
-
```case (R.id.button):
|
121
|
+
```case (R.id.button):```
|
122
|
-
//ここをif文とかで判定したい
|
122
|
+
```//ここをif文とかで判定したい```
|
123
|
-
Button button=findViewById(R.id.button);
|
123
|
+
```Button button=findViewById(R.id.button);
|
124
124
|
button2.setBackgroundColor(x);```
|
125
125
|
```//if(ここがわからない){
|
126
126
|
//色を変える作業
|
127
127
|
//}else{
|
128
128
|
//色を変える作業
|
129
|
-
//}
|
129
|
+
//}```
|
130
|
-
break;```
|
131
|
-
```case (R.id.button2):
|
132
|
-
break;```
|
133
|
-
```case (R.id.button3):
|
134
|
-
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
135
130
|
```break;```
|
131
|
+
```case (R.id.button2):```
|
132
|
+
```break;```
|
133
|
+
```case (R.id.button3):```
|
134
|
+
```Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
135
|
+
```break;```
|
136
136
|
//4から8も同じ感じで
|
137
137
|
|
138
|
-
```case (R.id.button9):
|
138
|
+
```case (R.id.button9):```
|
139
|
-
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
139
|
+
```Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
140
140
|
```break;```
|
141
141
|
}```
|
142
142
|
}```
|
35
title
CHANGED
File without changes
|
body
CHANGED
@@ -121,22 +121,22 @@
|
|
121
121
|
```case (R.id.button):
|
122
122
|
//ここをif文とかで判定したい
|
123
123
|
Button button=findViewById(R.id.button);
|
124
|
-
button2.setBackgroundColor(x);
|
124
|
+
button2.setBackgroundColor(x);```
|
125
|
-
//if(ここがわからない){
|
125
|
+
```//if(ここがわからない){
|
126
126
|
//色を変える作業
|
127
127
|
//}else{
|
128
128
|
//色を変える作業
|
129
129
|
//}
|
130
130
|
break;```
|
131
131
|
```case (R.id.button2):
|
132
|
-
|
132
|
+
break;```
|
133
133
|
```case (R.id.button3):
|
134
|
-
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
134
|
+
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
135
|
-
break;```
|
135
|
+
```break;```
|
136
|
-
|
136
|
+
//4から8も同じ感じで
|
137
137
|
|
138
|
-
```case (R.id.button9):
|
138
|
+
```case (R.id.button9):
|
139
|
-
|
139
|
+
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
140
140
|
```break;```
|
141
141
|
}```
|
142
142
|
}```
|
34
title
CHANGED
File without changes
|
body
CHANGED
@@ -122,19 +122,17 @@
|
|
122
122
|
//ここをif文とかで判定したい
|
123
123
|
Button button=findViewById(R.id.button);
|
124
124
|
button2.setBackgroundColor(x);
|
125
|
-
|
126
|
-
|
125
|
+
//if(ここがわからない){
|
127
|
-
色を変える作業
|
128
|
-
}else{
|
129
126
|
//色を変える作業
|
127
|
+
//}else{
|
128
|
+
//色を変える作業
|
130
|
-
}
|
129
|
+
//}
|
131
130
|
break;```
|
132
|
-
```case (R.id.button2):
|
131
|
+
```case (R.id.button2):
|
133
|
-
```//ここからボタン9までボタン1と同じ判定ような判定がしたい```
|
134
|
-
|
132
|
+
break;```
|
135
|
-
```case (R.id.button3):
|
133
|
+
```case (R.id.button3):
|
136
|
-
|
134
|
+
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
137
|
-
|
135
|
+
break;```
|
138
136
|
```//4から8も同じ感じで```
|
139
137
|
|
140
138
|
```case (R.id.button9):```
|
33
title
CHANGED
File without changes
|
body
CHANGED
@@ -118,11 +118,9 @@
|
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
|
-
```case (R.id.button):
|
121
|
+
```case (R.id.button):
|
122
|
-
|
123
|
-
|
122
|
+
//ここをif文とかで判定したい
|
124
|
-
|
125
|
-
|
123
|
+
Button button=findViewById(R.id.button);
|
126
124
|
button2.setBackgroundColor(x);
|
127
125
|
|
128
126
|
```//if(ここがわからない){
|
32
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
31
title
CHANGED
File without changes
|
body
CHANGED
@@ -144,5 +144,5 @@
|
|
144
144
|
```break;```
|
145
145
|
}```
|
146
146
|
}```
|
147
|
-
}```
|
147
|
+
```}```
|
148
|
-
}```
|
148
|
+
```}```
|
30
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
一応自分の作ってるやつ載せておきます。
|
39
39
|
|
40
40
|
|
41
|
-
|
41
|
+
public class MainActivity extends AppCompatActivity {
|
42
42
|
|
43
43
|
@Override
|
44
44
|
```protected void onCreate(Bundle savedInstanceState) {
|
@@ -67,7 +67,7 @@
|
|
67
67
|
|
68
68
|
|
69
69
|
```//ここはリセットなのできにしないで```
|
70
|
-
|
70
|
+
class MyClickListener implements View.OnClickListener {
|
71
71
|
@Override
|
72
72
|
```public void onClick(View v) {
|
73
73
|
```Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show(); ```
|
29
title
CHANGED
File without changes
|
body
CHANGED
@@ -122,15 +122,15 @@
|
|
122
122
|
|
123
123
|
```//ここをif文とかで判定したい```
|
124
124
|
|
125
|
-
```Button button=findViewById(R.id.button);
|
125
|
+
```Button button=findViewById(R.id.button);
|
126
|
-
|
126
|
+
button2.setBackgroundColor(x);
|
127
127
|
|
128
128
|
```//if(ここがわからない){
|
129
129
|
色を変える作業
|
130
130
|
}else{
|
131
131
|
//色を変える作業
|
132
132
|
}```
|
133
|
-
|
133
|
+
break;```
|
134
134
|
```case (R.id.button2):```
|
135
135
|
```//ここからボタン9までボタン1と同じ判定ような判定がしたい```
|
136
136
|
```break;```
|
28
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
一応自分の作ってるやつ載せておきます。
|
39
39
|
|
40
40
|
|
41
|
-
public class MainActivity extends AppCompatActivity {
|
41
|
+
```public class MainActivity extends AppCompatActivity {
|
42
42
|
|
43
43
|
@Override
|
44
44
|
```protected void onCreate(Bundle savedInstanceState) {
|
@@ -67,7 +67,7 @@
|
|
67
67
|
|
68
68
|
|
69
69
|
```//ここはリセットなのできにしないで```
|
70
|
-
class MyClickListener implements View.OnClickListener {
|
70
|
+
```class MyClickListener implements View.OnClickListener {
|
71
71
|
@Override
|
72
72
|
```public void onClick(View v) {
|
73
73
|
```Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show(); ```
|
@@ -144,5 +144,5 @@
|
|
144
144
|
```break;```
|
145
145
|
}```
|
146
146
|
}```
|
147
|
-
|
147
|
+
}```
|
148
|
-
|
148
|
+
}```
|
27
title
CHANGED
File without changes
|
body
CHANGED
@@ -143,6 +143,6 @@
|
|
143
143
|
```Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
144
144
|
```break;```
|
145
145
|
}```
|
146
|
-
|
146
|
+
}```
|
147
147
|
```}```
|
148
148
|
```}```
|
26
title
CHANGED
File without changes
|
body
CHANGED
@@ -113,31 +113,31 @@
|
|
113
113
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
|
-
```public void onClick(View v) {
|
116
|
+
```public void onClick(View v) {
|
117
117
|
```int y= getResources().getColor(R.color.y);```
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
120
120
|
```switch (v.getId()) {
|
121
121
|
```case (R.id.button):```
|
122
122
|
|
123
|
-
//ここをif文とかで判定したい
|
123
|
+
```//ここをif文とかで判定したい```
|
124
124
|
|
125
125
|
```Button button=findViewById(R.id.button);```
|
126
126
|
```button2.setBackgroundColor(x);```
|
127
127
|
|
128
|
-
//if(ここがわからない){
|
128
|
+
```//if(ここがわからない){
|
129
129
|
色を変える作業
|
130
130
|
}else{
|
131
131
|
//色を変える作業
|
132
|
-
}
|
132
|
+
}```
|
133
133
|
```break;```
|
134
134
|
```case (R.id.button2):```
|
135
|
-
//ここからボタン9までボタン1と同じ判定ような判定がしたい
|
135
|
+
```//ここからボタン9までボタン1と同じ判定ような判定がしたい```
|
136
136
|
```break;```
|
137
137
|
```case (R.id.button3):```
|
138
138
|
```Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
139
139
|
```break;```
|
140
|
-
//4から8も同じ感じで
|
140
|
+
```//4から8も同じ感じで```
|
141
141
|
|
142
142
|
```case (R.id.button9):```
|
143
143
|
```Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
25
title
CHANGED
File without changes
|
body
CHANGED
@@ -113,7 +113,7 @@
|
|
113
113
|
|
114
114
|
class Click implements View.OnClickListener {
|
115
115
|
@Override
|
116
|
-
```public void onClick(View v) {
|
116
|
+
```public void onClick(View v) {```
|
117
117
|
```int y= getResources().getColor(R.color.y);```
|
118
118
|
```int x= getResources().getColor(R.color.x);```
|
119
119
|
|
24
title
CHANGED
File without changes
|
body
CHANGED
@@ -143,6 +143,6 @@
|
|
143
143
|
```Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
144
144
|
```break;```
|
145
145
|
}```
|
146
|
-
}```
|
146
|
+
```}```
|
147
147
|
```}```
|
148
148
|
```}```
|
23
title
CHANGED
File without changes
|
body
CHANGED
@@ -144,5 +144,5 @@
|
|
144
144
|
```break;```
|
145
145
|
}```
|
146
146
|
}```
|
147
|
-
}```
|
147
|
+
```}```
|
148
148
|
```}```
|
22
title
CHANGED
File without changes
|
body
CHANGED
@@ -111,8 +111,6 @@
|
|
111
111
|
|
112
112
|
```//ここから悩んでる所です。```
|
113
113
|
|
114
|
-
|
115
|
-
|
116
114
|
class Click implements View.OnClickListener {
|
117
115
|
@Override
|
118
116
|
```public void onClick(View v) {
|
@@ -147,4 +145,4 @@
|
|
147
145
|
}```
|
148
146
|
}```
|
149
147
|
}```
|
150
|
-
}```
|
148
|
+
```}```
|
21
title
CHANGED
File without changes
|
body
CHANGED
@@ -109,7 +109,7 @@
|
|
109
109
|
}```
|
110
110
|
|
111
111
|
|
112
|
-
//ここから悩んでる所です。
|
112
|
+
```//ここから悩んでる所です。```
|
113
113
|
|
114
114
|
|
115
115
|
|
20
title
CHANGED
File without changes
|
body
CHANGED
@@ -146,5 +146,5 @@
|
|
146
146
|
```break;```
|
147
147
|
}```
|
148
148
|
}```
|
149
|
-
|
149
|
+
}```
|
150
|
-
|
150
|
+
}```
|
19
title
CHANGED
File without changes
|
body
CHANGED
@@ -106,20 +106,20 @@
|
|
106
106
|
```button8.setBackgroundColor(y);```
|
107
107
|
|
108
108
|
}```
|
109
|
-
}```
|
109
|
+
}```
|
110
110
|
|
111
111
|
|
112
112
|
//ここから悩んでる所です。
|
113
113
|
|
114
114
|
|
115
115
|
|
116
|
-
|
116
|
+
class Click implements View.OnClickListener {
|
117
|
-
|
117
|
+
@Override
|
118
|
-
```
|
118
|
+
```public void onClick(View v) {
|
119
119
|
```int y= getResources().getColor(R.color.y);```
|
120
120
|
```int x= getResources().getColor(R.color.x);```
|
121
121
|
|
122
|
-
```switch (v.getId()) {
|
122
|
+
```switch (v.getId()) {
|
123
123
|
```case (R.id.button):```
|
124
124
|
|
125
125
|
//ここをif文とかで判定したい
|
@@ -144,7 +144,7 @@
|
|
144
144
|
```case (R.id.button9):```
|
145
145
|
```Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
146
146
|
```break;```
|
147
|
-
|
147
|
+
}```
|
148
|
-
|
148
|
+
}```
|
149
149
|
```}```
|
150
150
|
```}```
|
18
title
CHANGED
File without changes
|
body
CHANGED
@@ -99,14 +99,14 @@
|
|
99
99
|
// view は変更対象の部品に適宜置き換える
|
100
100
|
```button2.setBackgroundColor(y); ```// view は変更対象の部品に適宜置き換える
|
101
101
|
```button3.setBackgroundColor(y);```
|
102
|
-
```
|
102
|
+
```button4.setBackgroundColor(y);```
|
103
103
|
```button5.setBackgroundColor(y); ```
|
104
104
|
```button6.setBackgroundColor(y); ```
|
105
105
|
```button7.setBackgroundColor(y);```
|
106
106
|
```button8.setBackgroundColor(y);```
|
107
107
|
|
108
108
|
}```
|
109
|
-
}
|
109
|
+
}```
|
110
110
|
|
111
111
|
|
112
112
|
//ここから悩んでる所です。
|
17
title
CHANGED
File without changes
|
body
CHANGED
@@ -67,7 +67,7 @@
|
|
67
67
|
|
68
68
|
|
69
69
|
```//ここはリセットなのできにしないで```
|
70
|
-
|
70
|
+
class MyClickListener implements View.OnClickListener {
|
71
71
|
@Override
|
72
72
|
```public void onClick(View v) {
|
73
73
|
```Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show(); ```
|
@@ -106,7 +106,7 @@
|
|
106
106
|
```button8.setBackgroundColor(y);```
|
107
107
|
|
108
108
|
}```
|
109
|
-
}
|
109
|
+
}
|
110
110
|
|
111
111
|
|
112
112
|
//ここから悩んでる所です。
|
16
title
CHANGED
File without changes
|
body
CHANGED
@@ -67,8 +67,6 @@
|
|
67
67
|
|
68
68
|
|
69
69
|
```//ここはリセットなのできにしないで```
|
70
|
-
|
71
|
-
|
72
70
|
```class MyClickListener implements View.OnClickListener {
|
73
71
|
@Override
|
74
72
|
```public void onClick(View v) {
|
15
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
}```
|
67
67
|
|
68
68
|
|
69
|
-
```//ここはリセットなのできにしないで
|
69
|
+
```//ここはリセットなのできにしないで```
|
70
70
|
|
71
71
|
|
72
72
|
```class MyClickListener implements View.OnClickListener {
|
14
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
}```
|
67
67
|
|
68
68
|
|
69
|
-
|
69
|
+
```//ここはリセットなのできにしないで
|
70
70
|
|
71
71
|
|
72
72
|
```class MyClickListener implements View.OnClickListener {
|
13
title
CHANGED
File without changes
|
body
CHANGED
@@ -53,16 +53,15 @@
|
|
53
53
|
findViewById(R.id.button);
|
54
54
|
button1.setOnClickListener(new Click());```
|
55
55
|
|
56
|
-
```Button button2
|
56
|
+
```Button button2=
|
57
|
-
|
57
|
+
findViewById(R.id.button2);
|
58
58
|
button2.setOnClickListener(new Click());```
|
59
59
|
|
60
60
|
//3~8も同じ
|
61
61
|
|
62
62
|
|
63
|
-
```Button button9
|
63
|
+
```Button button9=
|
64
|
-
|
65
|
-
|
64
|
+
findViewById(R.id.button9);
|
66
65
|
button9.setOnClickListener(new Click());```
|
67
66
|
}```
|
68
67
|
|
12
title
CHANGED
File without changes
|
body
CHANGED
@@ -61,6 +61,7 @@
|
|
61
61
|
|
62
62
|
|
63
63
|
```Button button9
|
64
|
+
|
64
65
|
=findViewById(R.id.button9);
|
65
66
|
button9.setOnClickListener(new Click());```
|
66
67
|
}```
|
11
title
CHANGED
File without changes
|
body
CHANGED
@@ -60,7 +60,9 @@
|
|
60
60
|
//3~8も同じ
|
61
61
|
|
62
62
|
|
63
|
+
```Button button9
|
64
|
+
=findViewById(R.id.button9);
|
63
|
-
|
65
|
+
button9.setOnClickListener(new Click());```
|
64
66
|
}```
|
65
67
|
|
66
68
|
|
10
title
CHANGED
File without changes
|
body
CHANGED
@@ -45,13 +45,16 @@
|
|
45
45
|
```super.onCreate(savedInstanceState);```
|
46
46
|
```setContentView(R.layout.activity_main);```
|
47
47
|
|
48
|
+
```Button button_r =
|
48
|
-
|
49
|
+
findViewById(R.id.button_r);
|
49
50
|
button_r.setOnClickListener(new MyClickListener());```
|
50
51
|
|
52
|
+
```Button button1=
|
51
|
-
|
53
|
+
findViewById(R.id.button);
|
52
54
|
button1.setOnClickListener(new Click());```
|
53
55
|
|
56
|
+
```Button button2
|
54
|
-
|
57
|
+
=findViewById(R.id.button2);
|
55
58
|
button2.setOnClickListener(new Click());```
|
56
59
|
|
57
60
|
//3~8も同じ
|
@@ -61,7 +64,7 @@
|
|
61
64
|
}```
|
62
65
|
|
63
66
|
|
64
|
-
|
67
|
+
>ここはリセットなのできにしないで
|
65
68
|
|
66
69
|
|
67
70
|
```class MyClickListener implements View.OnClickListener {
|
@@ -69,15 +72,24 @@
|
|
69
72
|
```public void onClick(View v) {
|
70
73
|
```Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show(); ```
|
71
74
|
|
75
|
+
```Button button=
|
72
|
-
|
76
|
+
findViewById(R.id.button);```
|
77
|
+
```Button button1=
|
73
|
-
|
78
|
+
findViewById(R.id.button2);```
|
79
|
+
```Button button2=
|
74
|
-
|
80
|
+
findViewById(R.id.button3);```
|
81
|
+
```Button button3=
|
75
|
-
|
82
|
+
findViewById(R.id.button4);```
|
83
|
+
```Button button4=
|
76
|
-
|
84
|
+
findViewById(R.id.button5);```
|
85
|
+
```Button button5=
|
77
|
-
|
86
|
+
findViewById(R.id.button6);```
|
87
|
+
```Button button6=
|
78
|
-
|
88
|
+
findViewById(R.id.button7);```
|
89
|
+
```Button button7=
|
79
|
-
|
90
|
+
findViewById(R.id.button8);```
|
91
|
+
```Button button8=
|
80
|
-
|
92
|
+
findViewById(R.id.button9);```
|
81
93
|
|
82
94
|
```int y= getResources().getColor(R.color.y); ```
|
83
95
|
//R.color.xxx は name=”xxx”とした時
|
9
title
CHANGED
File without changes
|
body
CHANGED
@@ -64,9 +64,9 @@
|
|
64
64
|
//ここはリセットなのできにしないで
|
65
65
|
|
66
66
|
|
67
|
-
```class MyClickListener implements View.OnClickListener {
|
67
|
+
```class MyClickListener implements View.OnClickListener {
|
68
68
|
@Override
|
69
|
-
```public void onClick(View v) {
|
69
|
+
```public void onClick(View v) {
|
70
70
|
```Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show(); ```
|
71
71
|
|
72
72
|
```Button button=findViewById(R.id.button);```
|
@@ -93,8 +93,8 @@
|
|
93
93
|
```button7.setBackgroundColor(y);```
|
94
94
|
```button8.setBackgroundColor(y);```
|
95
95
|
|
96
|
-
|
96
|
+
}```
|
97
|
-
|
97
|
+
}```
|
98
98
|
|
99
99
|
|
100
100
|
//ここから悩んでる所です。
|
8
title
CHANGED
File without changes
|
body
CHANGED
@@ -65,7 +65,7 @@
|
|
65
65
|
|
66
66
|
|
67
67
|
```class MyClickListener implements View.OnClickListener {```
|
68
|
-
|
68
|
+
@Override
|
69
69
|
```public void onClick(View v) {```
|
70
70
|
```Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show(); ```
|
71
71
|
|
7
title
CHANGED
File without changes
|
body
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
public class MainActivity extends AppCompatActivity {
|
42
42
|
|
43
|
-
|
43
|
+
@Override
|
44
44
|
```protected void onCreate(Bundle savedInstanceState) {
|
45
45
|
```super.onCreate(savedInstanceState);```
|
46
46
|
```setContentView(R.layout.activity_main);```
|
6
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
5
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
4
title
CHANGED
File without changes
|
body
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
public class MainActivity extends AppCompatActivity {
|
42
42
|
|
43
43
|
```@Override```
|
44
|
-
```protected void onCreate(Bundle savedInstanceState) {
|
44
|
+
```protected void onCreate(Bundle savedInstanceState) {
|
45
45
|
```super.onCreate(savedInstanceState);```
|
46
46
|
```setContentView(R.layout.activity_main);```
|
47
47
|
|
@@ -58,7 +58,7 @@
|
|
58
58
|
|
59
59
|
|
60
60
|
```Button button9 =findViewById(R.id.button9);button9.setOnClickListener(new Click());```
|
61
|
-
|
61
|
+
}```
|
62
62
|
|
63
63
|
|
64
64
|
//ここはリセットなのできにしないで
|
3
title
CHANGED
File without changes
|
body
CHANGED
@@ -45,21 +45,19 @@
|
|
45
45
|
```super.onCreate(savedInstanceState);```
|
46
46
|
```setContentView(R.layout.activity_main);```
|
47
47
|
|
48
|
-
```Button button_r = findViewById(R.id.button_r);
|
48
|
+
```Button button_r = findViewById(R.id.button_r);
|
49
|
+
button_r.setOnClickListener(new MyClickListener());```
|
49
50
|
|
51
|
+
```Button button1=findViewById(R.id.button);
|
50
|
-
|
52
|
+
button1.setOnClickListener(new Click());```
|
51
53
|
|
52
|
-
```Button
|
54
|
+
```Button button2 =findViewById(R.id.button2);
|
53
|
-
|
55
|
+
button2.setOnClickListener(new Click());```
|
54
56
|
|
55
|
-
```Button button2 =findViewById(R.id.button2);```
|
56
|
-
```button2.setOnClickListener(new Click());```
|
57
|
-
|
58
57
|
//3~8も同じ
|
59
58
|
|
60
59
|
|
61
|
-
```Button button9 =findViewById(R.id.button9);```
|
60
|
+
```Button button9 =findViewById(R.id.button9);button9.setOnClickListener(new Click());```
|
62
|
-
```button9.setOnClickListener(new Click());```
|
63
61
|
```}```
|
64
62
|
|
65
63
|
|
2
title
CHANGED
File without changes
|
body
CHANGED
@@ -40,111 +40,101 @@
|
|
40
40
|
|
41
41
|
public class MainActivity extends AppCompatActivity {
|
42
42
|
|
43
|
-
@Override
|
43
|
+
```@Override```
|
44
|
-
protected void onCreate(Bundle savedInstanceState) {
|
44
|
+
```protected void onCreate(Bundle savedInstanceState) {```
|
45
|
-
super.onCreate(savedInstanceState);
|
45
|
+
```super.onCreate(savedInstanceState);```
|
46
|
-
setContentView(R.layout.activity_main);
|
46
|
+
```setContentView(R.layout.activity_main);```
|
47
47
|
|
48
|
-
Button button_r = findViewById(R.id.button_r);
|
48
|
+
```Button button_r = findViewById(R.id.button_r);```
|
49
|
-
button_r.setOnClickListener(new MyClickListener());
|
50
49
|
|
51
|
-
Button button1=findViewById(R.id.button);
|
52
|
-
|
50
|
+
```button_r.setOnClickListener(new MyClickListener());```
|
53
51
|
|
54
|
-
Button
|
52
|
+
```Button button1=findViewById(R.id.button);```
|
55
|
-
|
53
|
+
```button1.setOnClickListener(new Click());```
|
56
54
|
|
55
|
+
```Button button2 =findViewById(R.id.button2);```
|
56
|
+
```button2.setOnClickListener(new Click());```
|
57
57
|
|
58
58
|
//3~8も同じ
|
59
59
|
|
60
60
|
|
61
|
-
Button button9 =findViewById(R.id.button9);
|
61
|
+
```Button button9 =findViewById(R.id.button9);```
|
62
|
-
button9.setOnClickListener(new Click());
|
62
|
+
```button9.setOnClickListener(new Click());```
|
63
|
-
}
|
63
|
+
```}```
|
64
64
|
|
65
65
|
|
66
66
|
//ここはリセットなのできにしないで
|
67
67
|
|
68
68
|
|
69
|
-
class MyClickListener implements View.OnClickListener {
|
69
|
+
```class MyClickListener implements View.OnClickListener {```
|
70
|
-
@Override
|
70
|
+
```@Override```
|
71
|
-
public void onClick(View v) {
|
71
|
+
```public void onClick(View v) {```
|
72
|
-
|
72
|
+
```Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show(); ```
|
73
73
|
|
74
|
-
Button button=findViewById(R.id.button);
|
74
|
+
```Button button=findViewById(R.id.button);```
|
75
|
-
Button button1=findViewById(R.id.button2);
|
75
|
+
```Button button1=findViewById(R.id.button2);```
|
76
|
-
Button button2=findViewById(R.id.button3);
|
76
|
+
```Button button2=findViewById(R.id.button3);```
|
77
|
-
Button button3=findViewById(R.id.button4);
|
77
|
+
```Button button3=findViewById(R.id.button4);```
|
78
|
-
Button button4=findViewById(R.id.button5);
|
78
|
+
```Button button4=findViewById(R.id.button5);```
|
79
|
-
Button button5=findViewById(R.id.button6);
|
79
|
+
```Button button5=findViewById(R.id.button6);```
|
80
|
-
Button button6=findViewById(R.id.button7);
|
80
|
+
```Button button6=findViewById(R.id.button7);```
|
81
|
-
Button button7=findViewById(R.id.button8);
|
81
|
+
```Button button7=findViewById(R.id.button8);```
|
82
|
-
Button button8=findViewById(R.id.button9);
|
82
|
+
```Button button8=findViewById(R.id.button9);```
|
83
83
|
|
84
|
-
int y= getResources().getColor(R.color.y);
|
84
|
+
```int y= getResources().getColor(R.color.y); ```
|
85
|
+
//R.color.xxx は name=”xxx”とした時
|
86
|
+
```button.setBackgroundColor(y); ```
|
85
|
-
|
87
|
+
// view は変更対象の部品に適宜置き換える
|
88
|
+
```button1.setBackgroundColor(y);```
|
86
|
-
|
89
|
+
// view は変更対象の部品に適宜置き換える
|
87
|
-
button2.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
90
|
+
```button2.setBackgroundColor(y); ```// view は変更対象の部品に適宜置き換える
|
88
|
-
button3.setBackgroundColor(y);
|
91
|
+
```button3.setBackgroundColor(y);```
|
89
|
-
button4.setBackgroundColor(y);
|
92
|
+
```はbutton4.setBackgroundColor(y);```
|
90
|
-
button5.setBackgroundColor(y);
|
93
|
+
```button5.setBackgroundColor(y); ```
|
91
|
-
button6.setBackgroundColor(y);
|
94
|
+
```button6.setBackgroundColor(y); ```
|
92
|
-
button7.setBackgroundColor(y);
|
95
|
+
```button7.setBackgroundColor(y);```
|
93
|
-
button8.setBackgroundColor(y);
|
96
|
+
```button8.setBackgroundColor(y);```
|
94
97
|
|
95
|
-
}
|
98
|
+
```}```
|
96
|
-
}
|
99
|
+
```}```
|
97
100
|
|
98
101
|
|
99
102
|
//ここから悩んでる所です。
|
100
103
|
|
101
104
|
|
102
105
|
|
103
|
-
class Click implements View.OnClickListener {
|
106
|
+
```class Click implements View.OnClickListener {```
|
104
|
-
@Override
|
107
|
+
```@Override```
|
105
|
-
public void onClick(View v) {
|
108
|
+
```、public void onClick(View v) {```
|
106
|
-
int y= getResources().getColor(R.color.y);
|
109
|
+
```int y= getResources().getColor(R.color.y);```
|
107
|
-
int x= getResources().getColor(R.color.x);
|
110
|
+
```int x= getResources().getColor(R.color.x);```
|
108
111
|
|
109
|
-
switch (v.getId()) {
|
112
|
+
```switch (v.getId()) {```
|
110
|
-
case (R.id.button):
|
113
|
+
```case (R.id.button):```
|
111
114
|
|
112
115
|
//ここをif文とかで判定したい
|
113
116
|
|
114
|
-
Button button=findViewById(R.id.button);
|
117
|
+
```Button button=findViewById(R.id.button);```
|
115
|
-
button2.setBackgroundColor(x);
|
118
|
+
```button2.setBackgroundColor(x);```
|
116
119
|
|
117
120
|
//if(ここがわからない){
|
118
121
|
色を変える作業
|
119
122
|
}else{
|
120
123
|
//色を変える作業
|
121
124
|
}
|
122
|
-
break;
|
125
|
+
```break;```
|
123
|
-
case (R.id.button2):
|
126
|
+
```case (R.id.button2):```
|
124
127
|
//ここからボタン9までボタン1と同じ判定ような判定がしたい
|
125
|
-
break;
|
128
|
+
```break;```
|
126
|
-
case (R.id.button3):
|
129
|
+
```case (R.id.button3):```
|
127
|
-
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
130
|
+
```Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();```
|
128
|
-
break;
|
131
|
+
```break;```
|
129
|
-
|
132
|
+
//4から8も同じ感じで
|
130
|
-
|
133
|
+
|
131
|
-
break;
|
132
|
-
case (R.id.button5):
|
133
|
-
Toast.makeText(MainActivity.this, "5がおされた", Toast.LENGTH_SHORT).show();
|
134
|
-
break;
|
135
|
-
case (R.id.button6):
|
136
|
-
Toast.makeText(MainActivity.this, "6がおされた", Toast.LENGTH_SHORT).show();
|
137
|
-
break;
|
138
|
-
case (R.id.button7):
|
139
|
-
Toast.makeText(MainActivity.this, "7がおされた", Toast.LENGTH_SHORT).show();
|
140
|
-
break;
|
141
|
-
case (R.id.button8):
|
142
|
-
Toast.makeText(MainActivity.this, "8がおされた", Toast.LENGTH_SHORT).show();
|
143
|
-
break;
|
144
|
-
|
134
|
+
```case (R.id.button9):```
|
145
|
-
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();
|
135
|
+
```Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();```
|
146
|
-
break;
|
136
|
+
```break;```
|
147
|
-
}
|
137
|
+
```}```
|
148
|
-
}
|
138
|
+
```}```
|
149
|
-
}
|
139
|
+
```}```
|
150
|
-
}
|
140
|
+
```}```
|
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -40,115 +40,111 @@
|
|
40
40
|
|
41
41
|
public class MainActivity extends AppCompatActivity {
|
42
42
|
|
43
|
-
@Override
|
43
|
+
@Override
|
44
|
-
protected void onCreate(Bundle
|
44
|
+
protected void onCreate(Bundle savedInstanceState) {
|
45
|
-
super.onCreate(savedInstanceState);
|
45
|
+
super.onCreate(savedInstanceState);
|
46
|
-
setContentView(R.layout.activity_main);
|
46
|
+
setContentView(R.layout.activity_main);
|
47
47
|
|
48
|
-
Button button_r = findViewById(R.id.button_r);
|
48
|
+
Button button_r = findViewById(R.id.button_r);
|
49
|
-
button_r.setOnClickListener(new
|
49
|
+
button_r.setOnClickListener(new MyClickListener());
|
50
50
|
|
51
|
-
Button button1=findViewById(R.id.button);
|
51
|
+
Button button1=findViewById(R.id.button);
|
52
|
-
button1.setOnClickListener(new Click());
|
52
|
+
button1.setOnClickListener(new Click());
|
53
53
|
|
54
|
-
Button button2 =findViewById(R.id.button2);
|
54
|
+
Button button2 =findViewById(R.id.button2);
|
55
|
-
button2.setOnClickListener(new Click());
|
55
|
+
button2.setOnClickListener(new Click());
|
56
56
|
|
57
57
|
|
58
58
|
//3~8も同じ
|
59
59
|
|
60
60
|
|
61
|
-
Button button9 =findViewById(R.id.button9);
|
61
|
+
Button button9 =findViewById(R.id.button9);
|
62
|
-
button9.setOnClickListener(new Click());
|
62
|
+
button9.setOnClickListener(new Click());
|
63
|
-
}
|
63
|
+
}
|
64
64
|
|
65
65
|
|
66
66
|
//ここはリセットなのできにしないで
|
67
67
|
|
68
68
|
|
69
|
-
class MyClickListener implements View.OnClickListener {
|
69
|
+
class MyClickListener implements View.OnClickListener {
|
70
|
-
@Override
|
70
|
+
@Override
|
71
|
-
public void onClick(View v) {
|
71
|
+
public void onClick(View v) {
|
72
|
-
Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show();
|
72
|
+
Toast.makeText(MainActivity.this, "リセットしました", Toast.LENGTH_SHORT).show();
|
73
73
|
|
74
|
-
Button button=findViewById(R.id.button);
|
74
|
+
Button button=findViewById(R.id.button);
|
75
|
-
Button
|
75
|
+
Button button1=findViewById(R.id.button2);
|
76
|
-
Button button2=findViewById(R.id.button3);
|
76
|
+
Button button2=findViewById(R.id.button3);
|
77
|
-
Button button3=findViewById(R.id.button4);
|
77
|
+
Button button3=findViewById(R.id.button4);
|
78
|
-
Button button4=findViewById(R.id.button5);
|
78
|
+
Button button4=findViewById(R.id.button5);
|
79
|
-
Button button5=findViewById(R.id.button6);
|
79
|
+
Button button5=findViewById(R.id.button6);
|
80
|
-
Button button6=findViewById(R.id.button7);
|
80
|
+
Button button6=findViewById(R.id.button7);
|
81
|
-
Button button7=findViewById(R.id.button8);
|
81
|
+
Button button7=findViewById(R.id.button8);
|
82
|
-
Button button8=findViewById(R.id.button9);
|
82
|
+
Button button8=findViewById(R.id.button9);
|
83
83
|
|
84
|
-
int y= getResources().getColor(R.color.y); //R.color.xxx は name=”xxx”とした時
|
84
|
+
int y= getResources().getColor(R.color.y); //R.color.xxx は name=”xxx”とした時
|
85
|
-
button.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
85
|
+
button.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
86
|
-
button1.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
86
|
+
button1.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
87
|
-
button2.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
87
|
+
button2.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
88
|
-
button3.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
88
|
+
button3.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
89
|
-
button4.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
89
|
+
button4.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
90
|
-
button5.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
90
|
+
button5.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
91
|
-
button6.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
91
|
+
button6.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
92
|
-
button7.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
92
|
+
button7.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
93
|
-
button8.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
93
|
+
button8.setBackgroundColor(y); // view は変更対象の部品に適宜置き換える
|
94
94
|
|
95
|
-
}
|
95
|
+
}
|
96
|
-
}
|
96
|
+
}
|
97
97
|
|
98
98
|
|
99
99
|
//ここから悩んでる所です。
|
100
100
|
|
101
101
|
|
102
102
|
|
103
|
-
class Click implements View.OnClickListener {
|
103
|
+
class Click implements View.OnClickListener {
|
104
|
-
@Override
|
104
|
+
@Override
|
105
|
-
public void onClick(View v) {
|
105
|
+
public void onClick(View v) {
|
106
|
-
int y= getResources().getColor(R.color.y);
|
106
|
+
int y= getResources().getColor(R.color.y);
|
107
|
-
int x= getResources().getColor(R.color.x);
|
107
|
+
int x= getResources().getColor(R.color.x);
|
108
108
|
|
109
|
-
switch (v.getId()) {
|
109
|
+
switch (v.getId()) {
|
110
|
-
case (R.id.button):
|
110
|
+
case (R.id.button):
|
111
111
|
|
112
112
|
//ここをif文とかで判定したい
|
113
113
|
|
114
|
-
|
114
|
+
Button button=findViewById(R.id.button);
|
115
|
-
button2.setBackgroundColor(x);
|
115
|
+
button2.setBackgroundColor(x);
|
116
116
|
|
117
117
|
//if(ここがわからない){
|
118
118
|
色を変える作業
|
119
119
|
}else{
|
120
120
|
//色を変える作業
|
121
121
|
}
|
122
|
-
|
123
|
-
|
124
|
-
break;
|
122
|
+
break;
|
125
|
-
case (R.id.button2):
|
123
|
+
case (R.id.button2):
|
124
|
+
//ここからボタン9までボタン1と同じ判定ような判定がしたい
|
126
|
-
break;
|
125
|
+
break;
|
127
|
-
case (R.id.button3):
|
126
|
+
case (R.id.button3):
|
128
|
-
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
127
|
+
Toast.makeText(MainActivity.this, "3がおされた", Toast.LENGTH_SHORT).show();
|
129
|
-
break;
|
128
|
+
break;
|
130
|
-
case (R.id.button4):
|
129
|
+
case (R.id.button4):
|
131
|
-
Toast.makeText(MainActivity.this, "4がおされた", Toast.LENGTH_SHORT).show();
|
130
|
+
Toast.makeText(MainActivity.this, "4がおされた", Toast.LENGTH_SHORT).show();
|
132
|
-
break;
|
131
|
+
break;
|
133
|
-
case (R.id.button5):
|
132
|
+
case (R.id.button5):
|
134
|
-
Toast.makeText(MainActivity.this, "5がおされた", Toast.LENGTH_SHORT).show();
|
133
|
+
Toast.makeText(MainActivity.this, "5がおされた", Toast.LENGTH_SHORT).show();
|
135
|
-
break;
|
134
|
+
break;
|
136
|
-
case (R.id.button6):
|
135
|
+
case (R.id.button6):
|
137
|
-
Toast.makeText(MainActivity.this, "6がおされた", Toast.LENGTH_SHORT).show();
|
136
|
+
Toast.makeText(MainActivity.this, "6がおされた", Toast.LENGTH_SHORT).show();
|
138
|
-
break;
|
137
|
+
break;
|
139
|
-
case (R.id.button7):
|
138
|
+
case (R.id.button7):
|
140
|
-
Toast.makeText(MainActivity.this, "7がおされた", Toast.LENGTH_SHORT).show();
|
139
|
+
Toast.makeText(MainActivity.this, "7がおされた", Toast.LENGTH_SHORT).show();
|
141
|
-
break;
|
140
|
+
break;
|
142
|
-
case (R.id.button8):
|
141
|
+
case (R.id.button8):
|
143
|
-
Toast.makeText(MainActivity.this, "8がおされた", Toast.LENGTH_SHORT).show();
|
142
|
+
Toast.makeText(MainActivity.this, "8がおされた", Toast.LENGTH_SHORT).show();
|
144
|
-
break;
|
143
|
+
break;
|
145
|
-
case (R.id.button9):
|
144
|
+
case (R.id.button9):
|
146
|
-
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();
|
145
|
+
Toast.makeText(MainActivity.this, "9がおされた", Toast.LENGTH_SHORT).show();
|
147
|
-
break;
|
146
|
+
break;
|
148
|
-
|
149
|
-
}
|
147
|
+
}
|
150
|
-
}
|
148
|
+
}
|
151
|
-
|
152
|
-
}
|
149
|
+
}
|
153
|
-
|
154
150
|
}
|