title: com.google.firebase.database.DatabaseException: Can't convert object of type java.lang.String to type using a RecyclerView
body: <p>I am facing this problem since , i read this post <a href="https://stackoverflow.com/questions/38864428/database-databaseexception-cant-convert-object-of-type-java-lang-string-to-type">database.DatabaseException: Can&#39;t convert object of type java.lang.String to type</a>  but still am getting the same error, where am wrong please . I need your help am new in Firebase. </p>
  
  <p>This is my <code>MainActivity.java</code> class </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      private Button but;
      private DatabaseReference mRef;
      private MyAdapter adapter;
      public RecyclerView recyclerView;
  
      public List&lt;ModelClass&gt; doctors;
      public Context c;
      private LinearLayoutManager linearLayoutManager;
  
      public DatabaseReference mMovieRef ;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          doctors = new ArrayList&lt;ModelClass&gt;();
  
          recyclerView =(RecyclerView) findViewById(R.id.recyclerview);
  
          linearLayoutManager = new LinearLayoutManager(this);
          recyclerView.setLayoutManager(linearLayoutManager);
          recyclerView.setHasFixedSize(true);
          mRef =  FirebaseDatabase.getInstance().getReference("Doctors");
  
          mRef.addChildEventListener(new ChildEventListener() {
              @Override
              public void onChildAdded(DataSnapshot dataSnapshot, String s) {
                  LoadData(dataSnapshot);
              }
  
              @Override
              public void onChildChanged(DataSnapshot dataSnapshot, String s) {
                  LoadData(dataSnapshot);
              }
  
              public void onChildRemoved(DataSnapshot dataSnapshot) { }
              public void onChildMoved(DataSnapshot dataSnapshot, String s) { }
              public void onCancelled(DatabaseError databaseError) { }
          });
      }
  
      public void LoadData (DataSnapshot dataSnapshot){
          for(DataSnapshot ds :dataSnapshot.getChildren()){
              System.out.println(ds.getValue());
              ModelClass doc =ds.getValue(ModelClass.class);
  
             doctors.add(doc);
  
             adapter = new MyAdapter(MainActivity.this, doctors);
              recyclerView.setAdapter(adapter);
          }
      }
  }
  </code></pre>
  
  <p>This is my <code>Adapter</code> class </p>
  
  <pre><code>public class MyAdapter extends RecyclerView.Adapter&lt;MyViewHolder&gt; {
    protected   Context c;
      List&lt;ModelClass&gt; doctors;
      FirebaseStorage storage = FirebaseStorage.getInstance();
  
     StorageReference url =storage.getReferenceFromUrl("gs://askdoctor-546bf.appspot.com/");
  
      private List&lt;ModelClass&gt; itemList = null;
  
      public MyAdapter(Context c, List&lt;ModelClass&gt; doctors) {
          this.c = c;
          this.doctors = doctors;
      }
  
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
          View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_activity,parent,false);
          MyViewHolder holder = new MyViewHolder(v);
          return holder;
      }
  
      @Override
      public void onBindViewHolder(MyViewHolder holder, int position) {
          final  ModelClass feedItems = itemList.get(position);
  
          holder.name.setText(doctors.get(position).getDoctorsName());
          holder.email_txt.setText(doctors.get(position).getEmail());
        // PicassoClient.downloadImage(c,doctors.get(position).getUrl(),holder.img);
          //Download image using picasso library
          Picasso.with(c).load(url+ feedItems.getPhoto())
                  .error(R.mipmap.ic_launcher).
                  resize(120, 50)
                  .placeholder(R.mipmap.ic_launcher).into(holder.img);
      }
  
      @Override
      public int getItemCount() {
          return doctors.size();
      }
  }
  </code></pre>
  
  <p>This is my <code>model</code> class</p>
  
  <pre><code>public class ModelClass {
      private String DoctorsName;
      private String Email;
      private String Phone;
      private String Photo;
  
      public ModelClass() {
  
          // empty default constructor, necessary for Firebase to be able to deserialize  posts
      }
  
      public String getDoctorsName() {
          return DoctorsName;
      }
  
      public void setDoctorsName(String doctorsName) {
          DoctorsName = doctorsName;
      }
  
      public String getEmail() {
          return Email;
      }
  
      public void setEmail(String email) {
          Email = email;
      }
  
      public String getPhone() {
          return Phone;
      }
  
      public void setPhone(String phone) {
          Phone = phone;
      }
  
      public String getPhoto() {
          return Photo;
      }
  
      public void setPhoto(String photo) {
          Photo = photo;
      }
  }
  </code></pre>
  
  <p>This is my Firebase <a href="https://i.stack.imgur.com/Q3p9i.png" rel="nofollow noreferrer">database Console picture</a>.</p>