質問編集履歴
3
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,54 +13,55 @@
|
|
13
13
|
<追記>
|
14
14
|
ログを使って調べたところ、多くのテキストビューがnullになっていることがわかり、(全てのテキストビューを調べたわけではないので多くのと書きました)activityもnullになっていたので、もしかしたら何かしらの理由で、普通はフラグメントが開く前に通るところを通っていないんだと思います。
|
15
15
|
|
16
|
-
|
16
|
+
↑さらに追記です。
|
17
|
-
override fun onCreateView(
|
18
|
-
inflater: LayoutInflater, container: ViewGroup?,
|
19
|
-
savedInstanceState: Bundle?
|
20
|
-
|
17
|
+
ログを使ってさらに調べたところ、
|
21
|
-
// Inflate the layout for this fragment
|
22
|
-
|
18
|
+
FirebaseのaddSnapshotListener(リアルタイムでデータ取得するメソッド)を出力した後に、テキストビューがnullになっているということが判明しました。ますます意味がわかりません。なぜ、途中でテキストビューがnullになってしまうのでしょう??
|
23
|
-
}
|
24
|
-
```
|
25
19
|
|
26
20
|
```ここに言語を入力
|
27
|
-
|
21
|
+
private fun getTwoTeamInfoFromFirestore() {
|
28
|
-
teamRed: MutableList<Uid>,
|
29
|
-
teamBlue: MutableList<Uid>
|
30
|
-
) {
|
31
22
|
|
23
|
+
Log.d("text1", "$text_tell_which_team")//これはnullではない
|
24
|
+
listeningMembers = database.collection(dbCollection).document(keyword).collection("members")
|
25
|
+
.addSnapshotListener { it, e ->
|
26
|
+
val membersListUpdate: MutableList<Uid> = mutableListOf()
|
32
|
-
|
27
|
+
val teamRed: MutableList<Uid> = mutableListOf()
|
33
|
-
|
28
|
+
val teamBlue: MutableList<Uid> = mutableListOf()
|
34
|
-
teamRed.forEach {
|
35
|
-
teamRedNameList.add(it.name)
|
36
|
-
}
|
37
|
-
teamBlue.forEach {
|
38
|
-
teamBlueNameList.add(it.name)
|
39
|
-
}
|
40
29
|
|
41
|
-
|
30
|
+
Log.d("!!!!!!!!!!!!", "!!!!!!!!!!!!!!")
|
42
31
|
|
32
|
+
if(e != null) return@addSnapshotListener
|
33
|
+
if(it == null || it.isEmpty) return@addSnapshotListener
|
34
|
+
for (document in it) {
|
35
|
+
val name = document.getString("name")?: ""
|
36
|
+
val uid = document.id
|
43
|
-
|
37
|
+
val team = document.getString("team")
|
38
|
+
membersListUpdate.add(Uid(name, uid))
|
39
|
+
if(team == "RED") teamRed.add(Uid(name, uid)) else teamBlue.add(Uid(name, uid))
|
40
|
+
}
|
44
41
|
|
45
|
-
if (myTeam == "RED") {
|
46
|
-
|
42
|
+
Log.d("text2", "$text_tell_which_team")//null
|
47
|
-
|
43
|
+
membersList = membersListUpdate
|
48
|
-
} else {
|
49
|
-
text_tell_which_team.text = "${nickname}さん、あなたは青チームです"
|
50
|
-
text_my_team_members.text = teamBlueNameList.joinToString()
|
51
|
-
}
|
52
44
|
|
45
|
+
if(teamRed.size != 0) {
|
46
|
+
setSpinner(teamRed, teamBlue)
|
53
|
-
|
47
|
+
individualsInfo(teamRed, teamBlue)
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
54
|
-
|
51
|
+
```
|
55
52
|
|
53
|
+
```ここに言語を入力
|
54
|
+
override fun onCreateView(
|
55
|
+
inflater: LayoutInflater, container: ViewGroup?,
|
56
|
-
|
56
|
+
savedInstanceState: Bundle?
|
57
|
+
): View? {
|
58
|
+
// Inflate the layout for this fragment
|
59
|
+
return inflater.inflate(R.layout.fragment_game_setting, container, false)
|
57
60
|
}
|
58
|
-
|
59
61
|
```
|
60
62
|
|
61
|
-
|
62
63
|
```ここに言語を入力
|
63
|
-
<?xml version="1.0" encoding="utf-8"?>
|
64
|
+
<?xml version="1.0" encoding="utf-8"?>
|
64
65
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
65
66
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
66
67
|
xmlns:tools="http://schemas.android.com/tools"
|
2
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,6 +14,16 @@
|
|
14
14
|
ログを使って調べたところ、多くのテキストビューがnullになっていることがわかり、(全てのテキストビューを調べたわけではないので多くのと書きました)activityもnullになっていたので、もしかしたら何かしらの理由で、普通はフラグメントが開く前に通るところを通っていないんだと思います。
|
15
15
|
|
16
16
|
```ここに言語を入力
|
17
|
+
override fun onCreateView(
|
18
|
+
inflater: LayoutInflater, container: ViewGroup?,
|
19
|
+
savedInstanceState: Bundle?
|
20
|
+
): View? {
|
21
|
+
// Inflate the layout for this fragment
|
22
|
+
return inflater.inflate(R.layout.fragment_game_setting, container, false)
|
23
|
+
}
|
24
|
+
```
|
25
|
+
|
26
|
+
```ここに言語を入力
|
17
27
|
private fun individualsInfo(
|
18
28
|
teamRed: MutableList<Uid>,
|
19
29
|
teamBlue: MutableList<Uid>
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,6 +10,9 @@
|
|
10
10
|
他はGithubに載せているのでご参照ください。
|
11
11
|
[GitHub](https://github.com/yukari00/Codename)
|
12
12
|
|
13
|
+
<追記>
|
14
|
+
ログを使って調べたところ、多くのテキストビューがnullになっていることがわかり、(全てのテキストビューを調べたわけではないので多くのと書きました)activityもnullになっていたので、もしかしたら何かしらの理由で、普通はフラグメントが開く前に通るところを通っていないんだと思います。
|
15
|
+
|
13
16
|
```ここに言語を入力
|
14
17
|
private fun individualsInfo(
|
15
18
|
teamRed: MutableList<Uid>,
|