質問編集履歴
4
誤記修正。
title
CHANGED
File without changes
|
body
CHANGED
@@ -48,5 +48,6 @@
|
|
48
48
|
}
|
49
49
|
});
|
50
50
|
}
|
51
|
+
return view;
|
51
52
|
}
|
52
53
|
```
|
3
誤記修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
super.onCreate(savedInstanceState);
|
14
14
|
setContentView(R.layout.activity_main);
|
15
15
|
|
16
|
-
Button button = findViewById(R.id.
|
16
|
+
Button button = findViewById(R.id.button);
|
17
17
|
|
18
18
|
button.setOnClickListener(new View.OnClickListener() { // ボタンクリックでフラグメントへ
|
19
19
|
@Override
|
2
誤記修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
public void onClick(View view) {
|
47
47
|
|
48
48
|
}
|
49
|
-
}
|
49
|
+
});
|
50
50
|
}
|
51
51
|
}
|
52
52
|
```
|
1
誤記修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,6 +13,8 @@
|
|
13
13
|
super.onCreate(savedInstanceState);
|
14
14
|
setContentView(R.layout.activity_main);
|
15
15
|
|
16
|
+
Button button = findViewById(R.id.button_parent);
|
17
|
+
|
16
18
|
button.setOnClickListener(new View.OnClickListener() { // ボタンクリックでフラグメントへ
|
17
19
|
@Override
|
18
20
|
public void onClick(View view) {
|
@@ -30,14 +32,20 @@
|
|
30
32
|
|
31
33
|
// fragment
|
32
34
|
public class ParentFragment extends Fragment {
|
35
|
+
|
33
36
|
@Override
|
34
37
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
38
|
+
|
39
|
+
View view = inflater.inflate(R.layout.fragment_parent, container, false);
|
40
|
+
Button button2 = view.findViewById(R.id.button2);
|
41
|
+
|
35
42
|
String testStr = "テスト"; // Activityに送りたい値
|
36
43
|
|
37
|
-
|
44
|
+
button2.setOnClickListener(new View.OnClickListener() { // ボタンクリックでtestStrをActivityに送りたい。
|
38
|
-
|
45
|
+
@Override
|
39
|
-
|
46
|
+
public void onClick(View view) {
|
40
47
|
|
48
|
+
}
|
41
49
|
}
|
42
50
|
}
|
43
51
|
}
|