Буду признателен, если вы поможете мне.
activity.kotlin
var postsMap = HashMap<>() //Here error
postsMap.put("uid", current_user_id)
postsMap.put("date", saveCurrentDate)
postsMap.put("time", saveCurrentTime)
postsMap.put("description", Description)
postsMap.put("postimage", downloadUrl)
postsMap.put("profileimage", userProfileImage)
postsMap.put("fullname", userFullName)
PostsRef.child(current_user_id + postRandomName).updateChildren(postsMap)//Here error
.addOnCompleteListener(object : OnCompleteListener {//Here error
override fun onComplete(task: Task<*>) { //Here error
if (task.isSuccessful) {
SendUserToMainActivity()
Toast.makeText(
this@PostActivity,
"New Post is updated successfully.",
Toast.LENGTH_SHORT
).show()
} else {
Toast.makeText(
this@PostActivity,
"Error Occured while updating your post.",
Toast.LENGTH_SHORT
).show()
}
}
})
извините за неточный вопрос.
Спасибо
Я исправил код через ответ. Спасибо.
val postsMap: HashMap = hashMapOf ()
PostsRef !!. Child (current_user_id + postRandomName) .updateChildren (postsMap)