How to prevent custom views from losing state across screen orientation changes
I think this is a much simpler version. Bundle is a built-in type which implements Parcelable public class CustomView extends View { private int stuff; // stuff @Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(“superState”, super.onSaveInstanceState()); bundle.putInt(“stuff”, this.stuff); // … save stuff return bundle; } @Override public void onRestoreInstanceState(Parcelable state) { if … Read more