title: Firebase Can't convert object of type java.lang.String to type
body: <p>I'm creating a simple library app where books can be added and a list of books can be viewed. </p>
  
  <p>here is my book class</p>
  
  <pre><code>public class Book {
  
  private int _id;
  private String _bookTitle;
  private String _bookAuthor;
  private int _bookISBN;
  
  private Map&lt;String, Object&gt; mp;
  
  public Book() {
  
  }
  
  public Book(String _bookTitle, String _bookAuthor, int _bookISBN) {
      this._id = _id;
      this._bookTitle = _bookTitle;
      this._bookAuthor = _bookAuthor;
      this._bookISBN = _bookISBN;
  
  }
  
  public int get_id() {
      return _id;
  }
  
  public void set_id(int _id) {
      this._id = _id;
  }
  
  public String get_bookTitle() {
      return _bookTitle;
  }
  
  public void set_bookTitle(String _bookTitle) {
      this._bookTitle = _bookTitle;
  }
  
  public String get_bookAuthor() {
      return _bookAuthor;
  }
  
  public void set_bookAuthor(String _bookAuthor) {
      this._bookAuthor = _bookAuthor;
  }
  
  public int get_bookISBN() {
      return _bookISBN;
  }
  
  public void set_bookISBN(int _bookISBN) {
      this._bookISBN = _bookISBN;
  }
  
  
  public Map&lt;String, Object&gt; toMap() {
      mp = new HashMap&lt;&gt;();
      mp.put("bookTitle", this._bookTitle);
      mp.put("bookAuthor", this._bookAuthor);
      mp.put("bookISBN", this._bookISBN);
  
  
      return mp;
  } }
  </code></pre>
  
  <p>and here is where I am trying to read from the values which are already written into firebase </p>
  
  <p><img src="https://i.stack.imgur.com/6wr70.png" alt="snapshot of firebase"></p>
  
  <pre><code>public class ViewBook extends AppCompatActivity {
  
  
  ArrayList&lt;String&gt; myArrayList = new ArrayList&lt;&gt;();
  
  final FirebaseDatabase database = FirebaseDatabase.getInstance();
  DatabaseReference ref = database.getReference();
  //  DatabaseReference mPostReference = ref.child("books");
  DatabaseReference temp = ref.child("books");
  
  ArrayAdapter&lt;String&gt; adapter;
  
  @Override
  public void onStart(){
      super.onStart();
  
  
      ValueEventListener postListener = new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
                  Book book = postSnapshot.getValue(Book.class);
  
                  myArrayList.add(book.get_bookTitle() + "\n" + book.get_bookAuthor()  + "\n" + book.get_bookISBN());
  
  
              }
  
              ListView lv = (ListView)findViewById(R.id.list);
              adapter = new ArrayAdapter&lt;String&gt;(ViewBook.this, android.R.layout.simple_list_item_1, myArrayList);
              lv.setAdapter(adapter);
          }
  
  
          @Override
          public void onCancelled(DatabaseError databaseError) {
              //Getting Post failed, log a message
              Log.w("VIEWBOOKS", "loadPost:onCancelled", databaseError.toException());
  
          }
      };
      temp.addValueEventListener(postListener);
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_view_book);
  }}
  </code></pre>
  
  <p>the error I am getting is </p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
                Process: com.example.taylorcampos.androidfirebasedatabase, PID: 25339
                com.google.firebase.database.DatabaseException: Can't convert object of type java.lang.String to type com.example.taylorcampos.androidfirebasedatabase.Book
                    at com.google.android.gms.internal.zzbtg.zze(Unknown Source)
                    at com.google.android.gms.internal.zzbtg.zzb(Unknown Source)
                    at com.google.android.gms.internal.zzbtg.zza(Unknown Source)
                    at com.google.firebase.database.DataSnapshot.getValue(Unknown Source)
                    at com.example.taylorcampos.androidfirebasedatabase.ViewBook$1.onDataChange(ViewBook.java:38)
                    at com.google.android.gms.internal.zzbpx.zza(Unknown Source)
                    at com.google.android.gms.internal.zzbqx.zzZT(Unknown Source)
                    at com.google.android.gms.internal.zzbra$1.run(Unknown Source)
                    at android.os.Handler.handleCallback(Handler.java:751)
                    at android.os.Handler.dispatchMessage(Handler.java:95)
                    at android.os.Looper.loop(Looper.java:154)
                    at android.app.ActivityThread.main(ActivityThread.java:6119)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
  </code></pre>
  
  <p>Someone please explain why this is happening and how I could get the list view to list these books that have been put into firebase.</p>