0

this link shows "How to prevent Custom Views from losing state across screen orientation changes" for java. My question is "How to prevent Custom Views from losing state across screen orientation changes" for Mono for Android.

And How transfer java code to c# code

public static final Parcelable.Creator<SavedState> CREATOR =
    new Parcelable.Creator<SavedState>() {
      public SavedState createFromParcel(Parcel in) {
        return new SavedState(in);
      }
      public SavedState[] newArray(int size) {
        return new SavedState[size];
      }
};
Community
  • 1
  • 1
Alexadnr
  • 83
  • 1
  • 1
  • 8

1 Answers1

1

I don't know if you want to do is possible or not but I do know that at this time a translation of the example java code is not possible because it is using Parcelable.

Below is an excerpt from the mono for android limitations page which can be viewed here

Android.OS.IParcelable cannot be implemented.

The IParcelable interface cannot be implemented at this time because the android.os.Parcelable interface requires:

Classes implementing the Parcelable interface must also have a static field called CREATOR, which is an object implementing the Parcelable.Creator interface.

Since mandroid.exe currently cannot generate fields, this interface cannot be implemented. Support will be added in a future release.

Travis
  • 241
  • 1
  • 10