I've got class Playlist extends ArrayList I use in
Playlist playlist = new Playlist();
intent.putExtra("playlist", playlist);
and then I try to get it back:
if (getIntent().hasExtra("playlist")) {
playlist = (Playlist)(getIntent().getExtras().getStringArrayList("playlist"));
}
but I receive an error: Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to pl.mal.player.Playlist. I know that to problem is I would like to cast base class to child class. But I do not know how to avoid it in this example. Can someone help me?