SearchableSpinner
SearchableSpinner copied to clipboard
Illegal State Exception . Fragment Already added
On clicking searchable spinner two times quickly crashes the activity
Change this line in the library code
https://github.com/miteshpithadiya/SearchableSpinner/blob/592d86a22b69ea28b54b6aa1cc9b61146971d304/searchablespinnerlibrary/src/main/java/com/toptoche/searchablespinnerlibrary/SearchableSpinner.java#L91
to
if (!_searchableListDialog.isAdded()) {
_searchableListDialog.show(scanForActivity(_context).getFragmentManager(), "TAG");
}
Still this issue is there
just add this OnTouchListener in your spinner.
private long mLastClickTime = 0; searchablespinner.setOnTouchListener((v, event) -> { if (SystemClock.elapsedRealtime() - mLastClickTime < 1000){ return false; } mLastClickTime = SystemClock.elapsedRealtime();; event.setAction(MotionEvent.ACTION_UP); searchablespinner.onTouch(v,event); return false; });
Hello how to edit library file? Because File is read only mode