SearchableSpinner
SearchableSpinner copied to clipboard
App crashes when the spinner search dialog is open and the activity onPuase()/onStop() is called
In my case, I just open Overview Screen ("Recent Apps") while I have the SearchableSpinner dialog box open in an activity. As soon as the OnPause() is called, the app crashes. 100% reproducible.
Exception logcat:
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner)
Same issue here. Did you find a solution?
Get the code SearchableSpinner file locally to your project, and add "implements Serializable" to the class definition.. I think that should solve it. I didn't check it yet. Waiting for a more accurate answer from the developer.
Finally figured out a solution.
Going through the SearchableSpinner library, the dialog (_searchableListDialog) is created with a tag "TAG".. so, to solve the problem, in the activity's or fragment's onPause() just find the dialog with that tag and remove it using fragment manager.
The following function does the same. Just use it in your onPause() or anytime before onSavedInstanceState().
public void removeSearchableDialog() {
Fragment searchableSpinnerDialog = getFragmentManager().findFragmentByTag("TAG");
if (searchableSpinnerDialog != null && searchableSpinnerDialog.isAdded()) {
getFragmentManager().beginTransaction().remove(searchableSpinnerDialog).commit();
}
}
PS: You got to do the reverse of it, if you want it back on your activity's or fragment's onResume().
Hi Mitesh, I am facing the same issue in my App, Can u please add this solution if it works, in the next update, It would be very helpful because I have been using your library on the production App. Thanks
Refer this : https://github.com/AnithJo/SearchableSpinner