質問編集履歴

1

コード部分を```で囲みました

2017/02/24 07:26

投稿

sakuma_yujin
sakuma_yujin

スコア27

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
-
29
+ ```
30
30
 
31
31
  import android.os.Bundle;
32
32
 
@@ -64,7 +64,7 @@
64
64
 
65
65
  }
66
66
 
67
-
67
+ ```
68
68
 
69
69
  ----
70
70
 
@@ -74,7 +74,7 @@
74
74
 
75
75
  First.java
76
76
 
77
-
77
+ ```
78
78
 
79
79
  import android.app.Activity;
80
80
 
@@ -90,6 +90,8 @@
90
90
 
91
91
  import android.widget.EditText;
92
92
 
93
+ import android.widget.ImageButton;
94
+
93
95
  import android.widget.TextView;
94
96
 
95
97
 
@@ -106,6 +108,8 @@
106
108
 
107
109
  private Button button_segue1;
108
110
 
111
+ private ImageButton imagebutton5;
112
+
109
113
  TextView textView;
110
114
 
111
115
  EditText editText;
@@ -130,7 +134,9 @@
130
134
 
131
135
 
132
136
 
133
-
137
+ imagebutton5=(ImageButton)findViewById(R.id.imageButton5);
138
+
139
+ imagebutton5.setOnClickListener(this);
134
140
 
135
141
  }
136
142
 
@@ -142,35 +148,25 @@
142
148
 
143
149
 
144
150
 
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
151
  if(v==button_segue1){
156
152
 
157
153
 
158
154
 
159
-
160
-
161
155
  Intent intent = new Intent(this, Second.class);
162
156
 
163
157
  startActivityForResult(intent, 0);
164
158
 
165
159
  }
166
160
 
167
-
168
-
169
-
170
-
171
- }
161
+ }
162
+
163
+
164
+
172
-
165
+ }
166
+
167
+
168
+
173
-
169
+ ```
174
170
 
175
171
  ----
176
172
 
@@ -180,15 +176,29 @@
180
176
 
181
177
 
182
178
 
183
- ActivityからFragmentを呼び出すときには
179
+ Activityからボタンを押してFragmentを呼び出すときには
180
+
184
-
181
+ ```
182
+
185
-
183
+ //ボタンクリック時の関数
184
+
186
-
185
+ public void onClick(View v) {
186
+
187
+
188
+
189
+ if(v==button_segue1){
190
+
191
+
192
+
187
- Intent intent = new Intent(this, Second.class);
193
+ Intent intent = new Intent(this, Second.class);
188
194
 
189
195
  startActivityForResult(intent, 0);
190
196
 
191
-
197
+ }
198
+
199
+ }
200
+
201
+ ```
192
202
 
193
203
  でできたのですが同じことをやろうとするとエラーが出ます。
194
204