I can't seem to figure out why and how to solve this error I am getting on line:
MovieItem item = new MovieItem();
It says MovieItem() in MovieItem cannot be applied to:
Expected Parameters: id: String, title: String, overView: String, releaseDate: String, rating: String, posterPath: String, url: String.
Actual Arguments: .
private ArrayList<MovieItem> getMovieJsonObject(String movieJSONObject) throws JSONException {
final String m_Result = "results";
final String m_ID = "id";
final String m_Title = "title";
final String m_Release = "release_date";
final String m_Vote = "vote_average";
final String m_Overview = "overview";
final String m_Poster = "poster_path";
ArrayList<MovieItem> movieItems = new ArrayList<>();
JSONObject movieJSON = new JSONObject(movieJSONObject);
JSONArray movieInformation = movieJSON.getJSONArray(m_Result);
for (int i = 0; i < movieInformation.length(); i++) {
MovieItem item = new MovieItem();
JSONObject result_movie = movieInformation.getJSONObject(i);
movieId[i] = result_movie.getString(m_ID);
movieTitle[i] = result_movie.getString(m_Title);
moviePath[i] = result_movie.getString(m_Poster);
moviePlot[i] = result_movie.getString(m_Overview);
movieRating[i] = result_movie.getString(m_Vote);
movieReleaseDate[i] = result_movie.getString(m_Release);
movieItems.add(item);
}
return movieItems;
}
public class MovieItem {
private String id;
private String title;
private String overView;
private String releaseDate;
private String rating;
private String posterPath;
private String url;
public MovieItem(String id, String title, String overView, String releaseDate, String rating, String posterPath, String url) {
this.id = id;
this.title = title;
this.overView = overView;
this.releaseDate = releaseDate;
this.rating = rating;
this.posterPath = posterPath;
this.url = url;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getTitle() { return title; }
public void setTitle(String title) {
this.title = title;
}
public String getOverView() {
return overView;
}
public void setOverView(String overView) {
this.overView = overView;
}
public String getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
public String getRating() {
return rating;
}
public void setRating(String rating) {
this.rating = rating;
}
public String getPosterPath() {
return posterPath;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
}
Use your constructor :