miteshpithadiya / SearchableSpinner

Spinner with searchable items.
672 stars 245 forks source link

Fatal Exception: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner) #117

Open DeviseElectronics opened 4 years ago

DeviseElectronics commented 4 years ago

Caused by java.io.NotSerializableException: android.widget.ArrayAdapter at java.io.ObjectOutputStream.writeObject0 + 1240(ObjectOutputStream.java:1240) at java.io.ObjectOutputStream.defaultWriteFields + 1604(ObjectOutputStream.java:1604) at java.io.ObjectOutputStream.writeSerialData + 1565(ObjectOutputStream.java:1565) at java.io.ObjectOutputStream.writeOrdinaryObject + 1488(ObjectOutputStream.java:1488) at java.io.ObjectOutputStream.writeObject0 + 1234(ObjectOutputStream.java:1234) at java.io.ObjectOutputStream.writeObject + 354(ObjectOutputStream.java:354) at android.os.Parcel.writeSerializable + 1828(Parcel.java:1828) at android.os.Parcel.writeValue + 1780(Parcel.java:1780) at android.os.Parcel.writeArrayMapInternal + 928(Parcel.java:928) at android.os.BaseBundle.writeToParcelInner + 1589(BaseBundle.java:1589) at android.os.Bundle.writeToParcel + 1253(Bundle.java:1253) at android.os.Parcel.writeBundle + 997(Parcel.java:997) at android.app.FragmentState.writeToParcel + 122(FragmentState.java:122) at android.os.Parcel.writeTypedObject + 1634(Parcel.java:1634) at android.os.Parcel.writeTypedArray + 1614(Parcel.java:1614) at android.app.FragmentManagerState.writeToParcel + 619(FragmentManager.java:619) at android.os.Parcel.writeParcelable + 1801(Parcel.java:1801) at android.os.Parcel.writeValue + 1707(Parcel.java:1707) at android.os.Parcel.writeArrayMapInternal + 928(Parcel.java:928) at android.os.BaseBundle.writeToParcelInner + 1589(BaseBundle.java:1589) at android.os.Bundle.writeToParcel + 1253(Bundle.java:1253) at android.app.IActivityTaskManager$Stub$Proxy.activityStopped + 4545(IActivityTaskManager.java:4545) at android.app.servertransaction.PendingTransactionActions$StopInfo.run + 145(PendingTransactionActions.java:145) at android.os.Handler.handleCallback + 883(Handler.java:883) at android.os.Handler.dispatchMessage + 100(Handler.java:100) at android.os.Looper.loop + 214(Looper.java:214) at android.app.ActivityThread.main + 7682(ActivityThread.java:7682) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 516(RuntimeInit.java:516) at com.android.internal.os.ZygoteInit.main + 950(ZygoteInit.java:950)

RanbirKaushik commented 4 years ago

Save the state of spinner in OnSavedInstanceState()..

TechNov commented 2 years ago

Hello there, any solution ? i'm facing out this bug yet and not found how to solve it....

GoldenAppStudio commented 2 years ago

use this code..

@Override public void onSaveInstanceState(Bundle savedInstanceState) { spinnerId.onSaveInstanceState(); }

Ahmer8 commented 1 year ago

@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Save the list of strings to the instance state before the activity is destroyed outState.putSerializable(KEY_STRING_LIST, stringList); }

DanielCr95 commented 1 year ago

@Ahmer8

I am facing the same error above, i have a List, how can i add it to saveInstanceState?

Can you please include the code for saveInstanceState and onRestoreState?

Thanks a lot