回答編集履歴

1

誤字修正

2021/12/24 18:28

投稿

hoshi-takanori
hoshi-takanori

スコア7895

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- 理論上、getSystemService は null を返す場合がありますが、その場合 as を使った時点で落ちます。
7
+ 理論上、getSystemService は null を返す可能性がありますが、その場合 as を使った時点で落ちます。
8
8
 
9
9
  (ので、as? を使うか、ContextCompat.getSystemService を使って書くと良いでしょう。)
10
10