teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

ソース書き換え

2017/07/19 12:07

投稿

riroholll
riroholll

スコア57

title CHANGED
File without changes
body CHANGED
@@ -59,4 +59,92 @@
59
59
 
60
60
  CheckBox1.isChecked() == trueでtrueじゃなかった時
61
61
  CheckBox2.isChecked() == trueがtrueかどうかの確認をして
62
- trueの時はページ変移をするというプログラムを書きたいと考えています
62
+ trueの時はページ変移をするというプログラムを書きたいと考えています
63
+
64
+ 新しくソースを書き直しました
65
+
66
+ ```ここに言語を入力
67
+ public class SubActivity extends Activity {
68
+
69
+
70
+ @Override
71
+ protected void onCreate(Bundle savedInstanceState) {
72
+ super.onCreate(savedInstanceState);
73
+ setContentView(R.layout.activity_sub1);
74
+ final CheckBox CheckBox = (CheckBox) findViewById(R.id.checkBox2);
75
+ final CheckBox CheckBox1 = (CheckBox) findViewById(R.id.checkBox3);
76
+ final CheckBox CheckBox2 = (CheckBox) findViewById(R.id.checkBox4);
77
+ final CheckBox CheckBox3 = (CheckBox) findViewById(R.id.checkBox5);
78
+
79
+
80
+ CheckBox.setOnClickListener(new View.OnClickListener()
81
+
82
+ {
83
+
84
+
85
+
86
+
87
+
88
+ @Override
89
+ public void onClick(View v){
90
+
91
+ switch (v.getId()) {
92
+ case R.id.checkBox2:
93
+ if (CheckBox.isChecked() == true) {
94
+ Button Button = (Button) findViewById(R.id.button);
95
+ Button.setOnClickListener(new View.OnClickListener() {
96
+ @Override
97
+ public void onClick(View v) {
98
+ Intent intent = new Intent(getApplication(), MainActivity.class);
99
+ startActivity(intent);
100
+ }
101
+ });
102
+ }
103
+ break;
104
+ case R.id.checkBox3:
105
+ if (CheckBox1.isChecked() == true) {
106
+ Button Button = (Button) findViewById(R.id.button);
107
+ Button.setOnClickListener(new View.OnClickListener() {
108
+ @Override
109
+ public void onClick(View v) {
110
+ Intent intent = new Intent(getApplication(), MainActivity.class);
111
+ startActivity(intent);
112
+ }
113
+ });
114
+ }
115
+ break;
116
+ case R.id.checkBox4:
117
+ if (CheckBox2.isChecked() == true) {
118
+ Button Button = (Button) findViewById(R.id.button);
119
+ Button.setOnClickListener(new View.OnClickListener() {
120
+ @Override
121
+ public void onClick(View v) {
122
+ Intent intent = new Intent(getApplication(), MainActivity.class);
123
+ startActivity(intent);
124
+ }
125
+ });
126
+ }
127
+ break;
128
+ case R.id.checkBox5:
129
+ if (CheckBox3.isChecked() == true) {
130
+ Button Button = (Button) findViewById(R.id.button);
131
+ Button.setOnClickListener(new View.OnClickListener() {
132
+ @Override
133
+ public void onClick(View v) {
134
+ Intent intent = new Intent(getApplication(), MainActivity.class);
135
+ startActivity(intent);
136
+ }
137
+ });
138
+ }
139
+
140
+
141
+ }
142
+
143
+
144
+
145
+
146
+ }
147
+ });
148
+ }
149
+ }
150
+ ```

1

追加

2017/07/19 12:07

投稿

riroholll
riroholll

スコア57

title CHANGED
File without changes
body CHANGED
@@ -53,4 +53,10 @@
53
53
  ```
54
54
  CheckBoxの時は変移するのですがCheckBox1だと変移しません
55
55
  なんでなのでしょうか
56
- 回答よろしくお願いします
56
+ 回答よろしくお願いします
57
+
58
+ 追加です
59
+
60
+ CheckBox1.isChecked() == trueでtrueじゃなかった時
61
+ CheckBox2.isChecked() == trueがtrueかどうかの確認をして
62
+ trueの時はページ変移をするというプログラムを書きたいと考えています