TheUnreal
TheUnreal

Reputation: 24472

App crashes when minimized when dialog is open

I'm using Searchable spinner (https://github.com/miteshpithadiya/SearchableSpinner) and whenever the spinner dialog is open and I click the home button or anything to minimize my app, the app crashes with the following error code:

FATAL EXCEPTION: main
                                                                       Process: com.package, PID: 21974
                                                                       java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner)
                                                                           at android.os.Parcel.writeSerializable(Parcel.java:1468)
                                                                           at android.os.Parcel.writeValue(Parcel.java:1416)
                                                                           at android.os.Parcel.writeArrayMapInternal(Parcel.java:686)
                                                                           at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1330)
                                                                           at android.os.Bundle.writeToParcel(Bundle.java:1079)
                                                                           at android.os.Parcel.writeBundle(Parcel.java:711)

My adapter:

//Initializing Spinner
        spinner = (Spinner) findViewById(R.id.name);
        ArrayAdapter<CharSequence> nameAdapter = ArrayAdapter.createFromResource(this,
                R.array.name, android.R.layout.simple_spinner_item);
        // Specify the layout to use when the list of choices appears
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        // Apply the adapter to the spinner
        spinner.setAdapter(nameAdapter);

What's wrong? Is there any way to fix it "outside" the package?

Upvotes: 0

Views: 891

Answers (1)

Eric Bachhuber
Eric Bachhuber

Reputation: 3952

Looks like it is an issue with the library as other users reported the same issue on Github. You'll need to use a workaround such as this for dismissing the SearchableListDialog in onPause().

EDIT: in SearchableListDialog.java:

    @Override
    public void onPause() {
        dismiss();
        super.onPause();
    }

Upvotes: 1

Related Questions