@Override public void onQuerySubmit(String string) { view.clearResults(); view.showProgress(); if (string.equals("find all")) { robotSource.getAll(this); } else { robotSource.findByName(string, this); // regex for any positive number without leading "0". if (string.matches("^[1-9]\\d*$")) { robotSource.findById(string, this); } } }