質問編集履歴

2

記事の追加

2017/07/18 13:28

投稿

riroholll
riroholll

スコア57

test CHANGED
File without changes
test CHANGED
@@ -429,3 +429,31 @@
429
429
 
430
430
 
431
431
  このようなエラーが発生します
432
+
433
+
434
+
435
+
436
+
437
+ 更新
438
+
439
+ アルゴリズム的には
440
+
441
+
442
+
443
+ if checkbox2 =tree
444
+
445
+ の時
446
+
447
+ system.out.print(a)
448
+
449
+
450
+
451
+ else if checkbox3=tree
452
+
453
+
454
+
455
+ system.out.print(b)
456
+
457
+
458
+
459
+ みたいなプログラムを書きたいと思っている

1

修正

2017/07/18 13:28

投稿

riroholll
riroholll

スコア57

test CHANGED
File without changes
test CHANGED
@@ -255,3 +255,177 @@
255
255
 
256
256
 
257
257
  どのように直せばよいのでしょうか?
258
+
259
+
260
+
261
+ 追加
262
+
263
+ ```ここに言語を入力
264
+
265
+ package com.example.askad.myapplication;
266
+
267
+
268
+
269
+ import android.app.Activity;
270
+
271
+ import android.content.Intent;
272
+
273
+ import android.os.Bundle;
274
+
275
+ import android.view.View;
276
+
277
+ import android.widget.Button;
278
+
279
+ import android.widget.CheckBox;
280
+
281
+
282
+
283
+
284
+
285
+ public class SubActivity extends Activity {
286
+
287
+
288
+
289
+ @Override
290
+
291
+ protected void onCreate(Bundle savedInstanceState) {
292
+
293
+ super.onCreate(savedInstanceState);
294
+
295
+ setContentView(R.layout.activity_sub1);
296
+
297
+
298
+
299
+
300
+
301
+ final CheckBox CheckBox = (CheckBox)findViewById(R.id.checkBox2);
302
+
303
+ CheckBox.setOnClickListener(new View.OnClickListener(){
304
+
305
+
306
+
307
+ @Override
308
+
309
+ public void onClick(View v) {
310
+
311
+
312
+
313
+ if(CheckBox.isChecked() == true) {
314
+
315
+
316
+
317
+
318
+
319
+ Button Button = (Button) findViewById(R.id.button);
320
+
321
+ Button.setOnClickListener(new View.OnClickListener() {
322
+
323
+ @Override
324
+
325
+ public void onClick(View v) {
326
+
327
+ Intent intent = new Intent(getApplication(), MainActivity.class);
328
+
329
+ startActivity(intent);
330
+
331
+ }
332
+
333
+ });
334
+
335
+ }
336
+
337
+ else {
338
+
339
+
340
+
341
+ final CheckBox CheckBox = (CheckBox)findViewById(R.id.checkBox3);
342
+
343
+ CheckBox.setOnClickListener(new View.OnClickListener(){
344
+
345
+
346
+
347
+ @Override
348
+
349
+ public void onClick(View v) {
350
+
351
+
352
+
353
+ if(CheckBox.isChecked() == true) {
354
+
355
+
356
+
357
+
358
+
359
+ Button Button = (Button) findViewById(R.id.button);
360
+
361
+ Button.setOnClickListener(new View.OnClickListener() {
362
+
363
+ @Override
364
+
365
+ public void onClick(View v) {
366
+
367
+ Intent intent = new Intent(getApplication(), MainActivity.class);
368
+
369
+ startActivity(intent);
370
+
371
+ }
372
+
373
+ });
374
+
375
+ }
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+ }
384
+
385
+
386
+
387
+
388
+
389
+ }
390
+
391
+ });
392
+
393
+ }
394
+
395
+ }
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+ ```
422
+
423
+ に変更すると
424
+
425
+
426
+
427
+ ![イメージ説明](373540f11d2c418af6bc34c579976f4c.png)
428
+
429
+
430
+
431
+ このようなエラーが発生します