private void onTextChanged(CharSequence newText){
  mCurrentQuery=mSearchEditText.getText();
  if (!TextUtils.isEmpty(mCurrentQuery)) {
    displayVoiceButton(false);
    displayClearButton(true);
  }
 else {
    displayClearButton(false);
    displayVoiceButton(true);
  }
  if (mOnQueryTextListener != null) {
    mOnQueryTextListener.onQueryTextChange(newText.toString());
  }
  mOldQuery=mCurrentQuery;
}

private void onTextChanged ( CharSequence newText ) { mCurrentQuery = mSearchEditText . getText ( ) ; if ( ! TextUtils . isEmpty ( mCurrentQuery ) ) { displayVoiceButton ( false ) ; displayClearButton ( true ) ; } else { displayClearButton ( false ) ; displayVoiceButton ( true ) ; } if ( mOnQueryTextListener != null ) { mOnQueryTextListener . onQueryTextChange ( newText . toString ( ) ) ; } mOldQuery = mCurrentQuery ; }
filters and updates the buttons when text is changed .
