Wednesday, October 25, 2017

Onquerytextsubmit Bug Answer

Problem:
When you try to implement searchView, you add override two method onQueryTextSubmit and onQueryTextChange. The dilema 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;             } 
 
 

Sumber http://aldokelvianto.blogspot.com

No comments:

Post a Comment

Laptop Graphic Terbaik Untuk Desain Grafis 2014

Mereview Laptop Desain Grafis tahun 2014 OPOSIP - Ketika saya bekerja dari rumah saya mempunyai sebuah PC yang didedikasikan yang sang...