Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 状态恢复保存Exception #3

Open
hushenghao opened this issue Nov 14, 2019 · 2 comments
Open

fix 状态恢复保存Exception #3

hushenghao opened this issue Nov 14, 2019 · 2 comments

Comments

@hushenghao
Copy link

private static class SavedState extends BaseSavedState {
        private float minValue;
        private float maxValue;
        private float reserveValue;
        private int cellsCount;
        private float currSelectedMin;
        private float currSelectedMax;

        SavedState(Parcelable superState) {
            super(superState);
        }

        private SavedState(Parcel in) {
            super(in);
            minValue = in.readFloat();
            maxValue = in.readFloat();
            reserveValue = in.readFloat();
            cellsCount = in.readInt();
            currSelectedMin = in.readFloat();
            currSelectedMax = in.readFloat();
        }

        @Override
        public void writeToParcel(Parcel out, int flags) {
            super.writeToParcel(out, flags);
            out.writeFloat(minValue);
            out.writeFloat(maxValue);
            out.writeFloat(reserveValue);
            out.writeInt(cellsCount);
            out.writeFloat(currSelectedMin);
            out.writeFloat(currSelectedMax);
        }

        /**
         * 添加这段代码
         */
        public static final Parcelable.Creator<SavedState> CREATOR
                = new Parcelable.Creator<SavedState>() {
            @Override
            public SavedState createFromParcel(Parcel in) {
                return new SavedState(in);
            }


            @Override
            public SavedState[] newArray(int size) {
                return new SavedState[size];
            }
        };
@hushenghao
Copy link
Author

java.lang.RuntimeException: Parcel android.os.Parcel@f4614c8: Unmarshalling unknown type code 1084227584 at offset 2216
	at android.os.Parcel.readValue(Parcel.java:2444)
	at android.os.Parcel.readSparseArrayInternal(Parcel.java:2813)
	at android.os.Parcel.readSparseArray(Parcel.java:2068)
	at android.os.Parcel.readValue(Parcel.java:2422)
	at android.os.Parcel.readArrayMapInternal(Parcel.java:2732)
	at android.os.BaseBundle.unparcel(BaseBundle.java:271)
	at android.os.Bundle.getSparseParcelableArray(Bundle.java:934)
       ...

谁能想到是这个b的问题

@iielse
Copy link
Owner

iielse commented Nov 14, 2019

抱歉老哥,三年前的菜鸡代码。给你推荐 https://github.com/Jay-Goo/RangeSeekBar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants