質問編集履歴

2

ソース書き換え

2017/07/19 12:07

投稿

riroholll
riroholll

スコア57

test CHANGED
File without changes
test CHANGED
@@ -121,3 +121,179 @@
121
121
  CheckBox2.isChecked() == trueがtrueかどうかの確認をして
122
122
 
123
123
  trueの時はページ変移をするというプログラムを書きたいと考えています
124
+
125
+
126
+
127
+ 新しくソースを書き直しました
128
+
129
+
130
+
131
+ ```ここに言語を入力
132
+
133
+ public class SubActivity extends Activity {
134
+
135
+
136
+
137
+
138
+
139
+ @Override
140
+
141
+ protected void onCreate(Bundle savedInstanceState) {
142
+
143
+ super.onCreate(savedInstanceState);
144
+
145
+ setContentView(R.layout.activity_sub1);
146
+
147
+ final CheckBox CheckBox = (CheckBox) findViewById(R.id.checkBox2);
148
+
149
+ final CheckBox CheckBox1 = (CheckBox) findViewById(R.id.checkBox3);
150
+
151
+ final CheckBox CheckBox2 = (CheckBox) findViewById(R.id.checkBox4);
152
+
153
+ final CheckBox CheckBox3 = (CheckBox) findViewById(R.id.checkBox5);
154
+
155
+
156
+
157
+
158
+
159
+ CheckBox.setOnClickListener(new View.OnClickListener()
160
+
161
+
162
+
163
+ {
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+ @Override
176
+
177
+ public void onClick(View v){
178
+
179
+
180
+
181
+ switch (v.getId()) {
182
+
183
+ case R.id.checkBox2:
184
+
185
+ if (CheckBox.isChecked() == true) {
186
+
187
+ Button Button = (Button) findViewById(R.id.button);
188
+
189
+ Button.setOnClickListener(new View.OnClickListener() {
190
+
191
+ @Override
192
+
193
+ public void onClick(View v) {
194
+
195
+ Intent intent = new Intent(getApplication(), MainActivity.class);
196
+
197
+ startActivity(intent);
198
+
199
+ }
200
+
201
+ });
202
+
203
+ }
204
+
205
+ break;
206
+
207
+ case R.id.checkBox3:
208
+
209
+ if (CheckBox1.isChecked() == true) {
210
+
211
+ Button Button = (Button) findViewById(R.id.button);
212
+
213
+ Button.setOnClickListener(new View.OnClickListener() {
214
+
215
+ @Override
216
+
217
+ public void onClick(View v) {
218
+
219
+ Intent intent = new Intent(getApplication(), MainActivity.class);
220
+
221
+ startActivity(intent);
222
+
223
+ }
224
+
225
+ });
226
+
227
+ }
228
+
229
+ break;
230
+
231
+ case R.id.checkBox4:
232
+
233
+ if (CheckBox2.isChecked() == true) {
234
+
235
+ Button Button = (Button) findViewById(R.id.button);
236
+
237
+ Button.setOnClickListener(new View.OnClickListener() {
238
+
239
+ @Override
240
+
241
+ public void onClick(View v) {
242
+
243
+ Intent intent = new Intent(getApplication(), MainActivity.class);
244
+
245
+ startActivity(intent);
246
+
247
+ }
248
+
249
+ });
250
+
251
+ }
252
+
253
+ break;
254
+
255
+ case R.id.checkBox5:
256
+
257
+ if (CheckBox3.isChecked() == true) {
258
+
259
+ Button Button = (Button) findViewById(R.id.button);
260
+
261
+ Button.setOnClickListener(new View.OnClickListener() {
262
+
263
+ @Override
264
+
265
+ public void onClick(View v) {
266
+
267
+ Intent intent = new Intent(getApplication(), MainActivity.class);
268
+
269
+ startActivity(intent);
270
+
271
+ }
272
+
273
+ });
274
+
275
+ }
276
+
277
+
278
+
279
+
280
+
281
+ }
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+ }
292
+
293
+ });
294
+
295
+ }
296
+
297
+ }
298
+
299
+ ```

1

追加

2017/07/19 12:07

投稿

riroholll
riroholll

スコア57

test CHANGED
File without changes
test CHANGED
@@ -109,3 +109,15 @@
109
109
  なんでなのでしょうか
110
110
 
111
111
  回答よろしくお願いします
112
+
113
+
114
+
115
+ 追加です
116
+
117
+
118
+
119
+ CheckBox1.isChecked() == trueでtrueじゃなかった時
120
+
121
+ CheckBox2.isChecked() == trueがtrueかどうかの確認をして
122
+
123
+ trueの時はページ変移をするというプログラムを書きたいと考えています