So I want to print out a list of movies from the database to a `ListView` and I'm using an `ArrayAdapter`, but when I run the app, it gives me this.

[![enter image description here](https://i.stack.imgur.com/fXu2m.png)](https://i.stack.imgur.com/fXu2m.png)

I think the problem is in the `ArrayAdapter` or the `ListView`:

Code:

My model class;

```
public class Movie 
{
   private int id;
   private String name;
   private String genre;
   private int year;

   public long 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 String getGenre()
   {
       return genre;
   }

   public void setGenre(String genre)
   {
       this.genre = genre;
   }

   public int getYear()
   {
       return year;
   }

   public void setYear(int year)
   {
       this.year = year;
   }

```

}

In my DBHandle I have; 

```
   private Movie cursorToMovie (Cursor cursor)
   {

    Movie movie = new Movie();
    movie.setId(cursor.getInt(0));
    movie.setName(cursor.getString(1));
    movie.setGenre(cursor.getString(2));
    movie.setYear(cursor.getInt(3));

    return movie;
  }

  public List<Movie> getAllMovies()
  {
      open();
      List<Movie> movieList = new ArrayList<>();
      Cursor cursor = db.query(Movie.TABLE_NAME, MovieAllColumns, null, null, null, null, null);
      cursor.moveToFirst();
      while (!cursor.isAfterLast())
      {
          Movie movie = cursorToMovie(cursor);
          movieList.add(movie);
          cursor.moveToNext();
      }

      cursor.close();
      close();
      return movieList;

  }

```

And in my MainActivity I have (it's here, I think, in the `GetAllMovies` method)

```
public class MainActivity extends AppCompatActivity 
{

   MoviesRepository moviesRepository;

   @Override
   protected void onCreate(Bundle savedInstanceState)
   {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

     GetAllMovies();
   }

   public void GetAllMovies()
   {
      moviesRepository = new MoviesRepository(this);
      moviesRepository.open();

      List<Movie> movieList = moviesRepository.getAllMovies(); // Gets all Movies from the database

      ArrayAdapter<Movie> adapter = new ArrayAdapter<Movie>(this, android.R.layout.simple_list_item_1, movieList); 

      ListView listView = (ListView) findViewById(R.id.ListViewMovie);
      listView.setAdapter(adapter); 
  }
}

```

Side note, when I debug it, I can see that the `movieList` is being populated by the `moviesRepository.getAllMovies()` return value and I can see all the movies' name, genre and year.