问题是什么? IDE 本身告诉您,需要一个 Int,但您正在传递一个 String。
要从资源中获取值,例如字符串、主题等...您需要传递资源的 Int 或 id,这是通过执行操作获得的
R.id.your_resource
所以看看你的代码:
val InterstitialId = dataSnapshot.child("interstitial_id").value.toString()
当您调用
.toString
方法时,此行将返回一个字符串,下面 2 行将此变量传递给 .getString
,并且根据 documentation getString()
需要一个 Int 而不是 String。