【发布时间】:2020-10-15 22:46:07
【问题描述】:
fun initFirebase(){
var database = FirebaseDatabase.getInstance()
var table = database.getReference("ToiletDB")
if(/*there is no data in database*/){
for(i in 0 until toilets.length()) {
val toilet = toilets.getJSONObject(i)
var temp = table.push()
temp.child("name").setValue(toilet.getString("FNAME"))
temp.child("time").setValue(null)
temp.child("facility").setValue(null)
}
}
}
我想第一次在数据库中写入一次数据。我该如何完成这项工作?
【问题讨论】:
标签: android json firebase firebase-realtime-database