I am creating a search counter using a third-party library. I added library classes (SearchableListDialog, SearchableSpinner) in my application. Everything works fine, but there is still one problem that I encountered, for example, in widget widgets, if I search for Abc, I do not get the result filtered as Abc, but when I click on the list items, the results show the element as Abc. This is similar to changing the position for items, but the list does not show the search result. I do not understand where I am mistaken. I modified the code several times, but did not get the desired result.

Spinner xml searchable code:
<com.example.my.currencyconverterapp.activity.SearchableSpinner android:id="@+id/spinner" android:layout_below="@+id/rl_currency_converterted_data" android:layout_width="wrap_content" android:layout_height="wrap_content" />
This is my snippet code where I install the adapter for the search.
countriesCustomAdapterInr = new CountriesCustomAdapterInr(getActivity(), R.layout.custom_spinner_items, arrayList,res); spinner.setAdapter(countriesCustomAdapterInr); assert spinner != null; spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { Toast.makeText(getActivity(), ""+arrayList.get(i).getFull_name()+i, Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> adapterView) {} });
This is a third-party SearchableSpinner class:
public class SearchableSpinner extends android.support.v7.widget.AppCompatSpinner implements View.OnTouchListener, SearchableListDialog.SearchableItem { public static final int NO_ITEM_SELECTED = -1; private Context _context; private List _items; private SearchableListDialog _searchableListDialog; private boolean _isDirty; private ArrayAdapter _arrayAdapter; private String _strHintText; private boolean _isFromInit; public SearchableSpinner(Context context) { super(context); this._context = context; init(); } public SearchableSpinner(Context context, AttributeSet attrs) { super(context, attrs); this._context = context; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SearchableSpinner); final int N = a.getIndexCount(); for (int i = 0; i < N; ++i) { int attr = a.getIndex(i); if (attr == R.styleable.SearchableSpinner_hintText) { _strHintText = a.getString(attr); } } a.recycle(); init(); } public SearchableSpinner(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this._context = context; init(); } private void init() { _items = new ArrayList(); _searchableListDialog = SearchableListDialog.newInstance (_items); _searchableListDialog.setOnSearchableItemClickListener(this); setOnTouchListener(this); _arrayAdapter = (ArrayAdapter) getAdapter(); if (!TextUtils.isEmpty(_strHintText)) { ArrayAdapter arrayAdapter = new ArrayAdapter(_context, android.R.layout .simple_list_item_1, new String[]{_strHintText}); _isFromInit = true; setAdapter(arrayAdapter); } } @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { if (null != _arrayAdapter) {
This is a third-party SearchableListDialog class:
public class SearchableListDialog extends DialogFragment implements SearchView.OnQueryTextListener, SearchView.OnCloseListener { private static final String ITEMS = "items"; private CountriesCustomAdapterInr listAdapter; private ListView _listViewItems; private SearchableItem _searchableItem; private OnSearchTextChanged _onSearchTextChanged; private SearchView _searchView; private String _strTitle; private String _strPositiveButtonText; private DialogInterface.OnClickListener _onClickListener; public SearchableListDialog() { } public static SearchableListDialog newInstance(List items) { SearchableListDialog multiSelectExpandableFragment = new SearchableListDialog(); Bundle args = new Bundle(); args.putSerializable(ITEMS, (Serializable) items); multiSelectExpandableFragment.setArguments(args); return multiSelectExpandableFragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams .SOFT_INPUT_STATE_HIDDEN); return super.onCreateView(inflater, container, savedInstanceState); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
Here, OnQueryTextListener () is not working fine. Please help me. I tried, but did not decide. Can someone help me please. Above, I mentioned my request. Thanks