一段時間以來一直在嘗試解決這個 Firebase 加載數組列表問題,但不知道如何解決。項目等級public class Book { private String title; private String author; private String ISBN; private String photo; private String ownerEmail; private String ownerID; private String BookID; private Date returnDate; private Status status; private String borrowerID; public Book(){} public Book(String title, String author, String ISBN, String photo, String ownerEmail, String ownerID) { this.title = title; this.author = author; this.ISBN = ISBN; this.photo = photo; this.ownerEmail = ownerEmail; this.ownerID = ownerID; this.status = Status.Available; if(this.BookID == null || this.BookID.isEmpty()) this.BookID = UUID.randomUUID().toString(); } public enum Status{ Available, Requested, Accepted, Borrowed } 這是我的 firebase 數據庫 firebase 數據庫 我不斷收到無法將類型對象轉換java.util.ArrayList為類型com.example.cmput301w19t15.Book在線錯誤Book book = dataSnapshot.getValue(Book.class); 我不確定為什么我收到轉換對象錯誤,我不想搜索單個變量并設置它們,這違背了對象類的目的我真的很想對此有所了解
Java/Android - 從 Firebase 將 ArrayList 作為對象加載時出錯
慕無忌1623718
2022-07-20 10:06:13