I have a complex class and need to save state when activity/fragment is destroyed and recreated.
I want to avoid using Parcelable if possible. Is this the best alternative in terms of simplicity and performance? I couldn't think of any other way to do it without leaving files/objects behind that would need to be cleaned up. public override void OnSaveInstanceState(Bundle bundle) { if (customClass != null) { var bf = new BinaryFormatter(); using (var ms = new MemoryStream()) { bf.Serialize(ms, customClass); bundle.PutByteArray("customClass", ms.ToArray()); } } base.OnSaveInstanceState(bundle); } -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Serializing-State-of-Complex-Class-tp5712833.html Sent from the Mono for Android mailing list archive at Nabble.com. _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid