Sharedpreference からカスタム オブジェクト Arralist を保存および取得したいのですが、コンパイル時エラーが発生しました
誰でも助けることができますか?
コード:
@Override protected void onPause() {
List<Movie> movieList;
super.onPause();
//save the movie list to preference
SharedPreferences preferences = getPreferences(MODE_PRIVATE);
Editor editor = preferences.edit();
try {
editor.putString("movies", org.apache.pig.impl.util.ObjectSerializer.serialize(movieList));
} catch (IOException e) {
e.printStackTrace();
}
editor.commit();
}
}
これがModelクラスです:
public class Movie implements Serializable {
private static final long serialVersionUID = 1L;
private String MovieName;
private String MovieActor;
private String MovieActress;
private String MovieDirector;
private String MovieImage;
private String MovieDescription;
private String MovieWatchLink;
public String getMovieName() {
return MovieName;
}
public void setMovieName(String movieName) {
MovieName = movieName;
}
public String getMovieActor() {
return MovieActor;
}
public void setMovieActor(String movieActor) {
MovieActor = movieActor;
}
public String getMovieActress() {
return MovieActress;
}
public void setMovieActress(String movieActress) {
MovieActress = movieActress;
}
public String getMovieDirector() {
return MovieDirector;
}
public void setMovieDirector(String movieDirector) {
MovieDirector = movieDirector;
}
public String getMovieImage() {
return MovieImage;
}
public void setMovieImage(String movieImage) {
MovieImage = movieImage;
}
public String getMovieDescription() {
return MovieDescription;
}
public void setMovieDescription(String movieDescription) {
MovieDescription = movieDescription;
}
public String getMovieWatchLink() {
return MovieWatchLink;
}
public void setMovieWatchLink(String movieWatchLink) {
MovieWatchLink = movieWatchLink;
}
コンパイル時エラー:
The method serialize(Serializable) in the type ObjectSerializer is not applicable for the
arguments (List<Movie>)