Hi guys, can somebody tell me why this happens, please read below.
I have my own class Data which extends Button. In my Activity's class I have a List<Data> which is appending with new Data object on each button click. I want to keep created objects of class Data on the screen after configuration changes, namely orientation change. So I've overrided onSaveInstanceState() and using it to restore my data in onCreate() method. In mentioned method I'm saving every Data object from the list of objects. In onCreate() method I'm trying to restore my data like this, the problem happens on line 18.
So in first case I'm getting IllegalStateException but it is working great for the second one. I don't understand the difference.
Just in case, here is my onSaveInstanceState() method:
And my Data class, but nothing special: