onQueryTextSubmit bug answer

  • 0
Problem:
When you try to implement searchView, you add override two method onQueryTextSubmit and onQueryTextChange. The problem occur when user try to press "search icon" on Soft Keyboard, which launch onQueryTextSubmit.

Solution:
It was because the query is null, (Android HATES null) so all I need to do is change it into empty String and request a focus.

@Override
            public boolean onQueryTextSubmit(String query) {
                searchView.setQuery("", false);
                searchView.requestFocus();
                return true;
            }


No comments:

Post a Comment

Kalau mau komen, pada "Beri Komentar Sebagai : "
Pilih "Name/URL", atau pakai akun google kalau punya.