title: how to pass List<NameOfClassObject> from activity to fragment
body: <p>here is my code for retrieving data from database using databasehelper class</p>
  
  <pre><code> public List&lt;Hospitals&gt; getHospitals(Context context){
      Hospitals hospitals = null;
      List&lt;Hospitals&gt; hospitalList = new ArrayList&lt;&gt;();
      openDatabase(context);
      Cursor cursor = database.rawQuery("SELECT * FROM buildings WHERE category_id = 1", null);
      cursor.moveToFirst();
      while(!cursor.isAfterLast()){
          hospitals = new Hospitals(cursor.getInt(0), cursor.getString(1), cursor.getFloat(2), cursor.getFloat(4));
          hospitalList.add(hospitals);
          cursor.moveToNext();
      }
      cursor.close();
      closeDatabase();
  
      return hospitalList;
  }
  </code></pre>
  
  <p>And Here is my Class Hospital</p>
  
  <pre><code>public class Hospitals {
  private int id;
  private String name;
  private Float latitude;
  private Float longhitude;
  
  public Hospitals(int id, String name, Float latitude, Float longhitude ){
      this.id = id;
      this.name = name;
      this.latitude = latitude;
      this.longhitude = longhitude;
  
  }
  
  public int getId() {
      return id;
  }
  
  public void setId(int id) {
      this.id = id;
  }
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public Float getLatitude() {
      return latitude;
  }
  
  public void setLatitude(Float latitude) {
      this.latitude = latitude;
  }
  
  public Float getLonghitude() {
      return longhitude;
  }
  
  public void setLonghitude(Float longhitude) {
      this.longhitude = longhitude;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and here is my code in main activity to pass List&lt;> to fragment</p>
  
  <pre><code>List&lt;Hospitals&gt; result = databaseHelper.getHospitals(this);
          Bundle bundle = new Bundle();
          bundle.putParcelableArrayList("valuesArray", result);
          GmapFragment gmapFragment = new GmapFragment();
          gmapFragment.setArguments(bundle);
          fragmentManager.beginTransaction().replace(R.id.mainLayout, gmapFragment).commit();
  </code></pre>
  
  <p>I got 2nd arguments in putParcelableArrayList() - Wrong 2nd argument type. Found: 'java.util.List', required: 'java.util.ArrayList</p>
  
  <p>how to solve that error?</p>