So hey guys, Im having some trouble with some code. Im implementing parcelables. Basically I have an List of items initiated globally as
private List
Sadly Android doesn't "program to the interface". If the List
is not an ArrayList
then you'll have no choice but to create a new ArrayList
. This isn't a big deal and can be done programmatically.
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
ArrayList<Movie> toSave = mMovieList instanceof ArrayList ?
(ArrayList<Movie>)mMovieList : new ArrayList<Movie>(mMovieList);
outState.putParcelableArrayList(MOVIE_KEY, toSave);
}