ผมลองใช้ที่เป็นลิ้งภาพตรงๆดูก็ใช้ได้แต่พอผมลองใช้เป็นตัวแปรก็ติน error ครับ
class UserItem(val user: User ): Item<ViewHolder>() {
override fun bind(viewHolder: ViewHolder, position: Int) {
viewHolder.itemView.username_textview_new_message.text = user.username
Picasso.get().load(user.ProfileImgUrl).into(viewHolder.itemView.imageview_new_message)
}
พอผมกดรันทดสอบดูมันแจ้งว่า
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myprojectalpha, PID: 3044
java.lang.IllegalArgumentException: Path must not be empty.
at com.squareup.picasso.Picasso.load(Picasso.java:332)
at com.example.myprojectalpha.UserItem.bind(NewMessageActivity.kt:77)
แต่พอผมไปดูใน log มันก็มีอยู่
D/NewMessage: DataSnapshot { key = 30Z9wrUreXM6K5GyEIuS0xWLkWe2, value = {uid=30Z9wrUreXM6K5GyEIuS0xWLkWe2, profileImgUrl=https://firebasestorage.googleapis.com/v0/b/chatproject-5f0eb.appspot.com/o/images%2F90bbe114-fbb3-4e13-8f03-e465ae2d9351?alt=media&token=f8bffe63-22e7-439f-b7f6-1bb3b1e3a364, username=user01} }
W/ClassMapper: No setter/field for profileImgUrl found on class com.example.myprojectalpha.User (fields/setters are case sensitive!)
D/NewMessage: DataSnapshot { key = 3qLviVRK97aHEJEIR4xibrAqDSv2, value = {uid=3qLviVRK97aHEJEIR4xibrAqDSv2, profileImgUrl=https://firebasestorage.googleapis.com/v0/b/chatproject-5f0eb.appspot.com/o/images%2Fa2ded0ba-65cd-48f2-a5e9-93058e2145e9?alt=media&token=bf90b63b-62e7-485e-8e60-7f8ef9ed1954, username=user02} }
ตอบ/อธิบาย