android.support.v7.widget.SearchView.OnQueryTextListener Java Examples

The following examples show how to use android.support.v7.widget.SearchView.OnQueryTextListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From ListViewVariants with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menuItem_search));
    searchView.setOnQueryTextListener(new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(final String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(final String newText) {
            performSearch(newText);
            return true;
        }
    });

    return super.onCreateOptionsMenu(menu);
}
 
Example #2
Source File: MainActivity.java    From ListViewVariants with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menuItem_search));
    searchView.setOnQueryTextListener(new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(final String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(final String newText) {
            performSearch(newText);
            return true;
        }
    });

    return super.onCreateOptionsMenu(menu);
}