@Override
 public boolean onQueryTextChange(String newText) {
   mListFragment.setQueryString(newText, true);
   return false;
 }
  /** Creates the fragment based on the current request. */
  public void configureListFragment() {
    switch (mActionCode) {
      case ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT:
        {
          ContactPickerFragment fragment = new ContactPickerFragment();
          fragment.setEditMode(true);
          fragment.setDirectorySearchMode(DirectoryListLoader.SEARCH_MODE_NONE);
          mListFragment = fragment;
          break;
        }

      case ContactsRequest.ACTION_PICK_CONTACT:
        {
          ContactPickerFragment fragment = new ContactPickerFragment();
          fragment.setIncludeProfile(mRequest.shouldIncludeProfile());
          mListFragment = fragment;
          break;
        }

      case ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT:
        {
          mListFragment = new ContactPickerFragment();
          break;
        }

      case ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT:
        {
          ContactPickerFragment fragment = new ContactPickerFragment();
          fragment.setShortcutRequested(true);
          mListFragment = fragment;
          break;
        }

      case ContactsRequest.ACTION_PICK_PHONE:
        {
          PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
          fragment.setUseCallableUri(true);
          mListFragment = fragment;
          break;
        }

      case ContactsRequest.ACTION_PICK_EMAIL:
        {
          mListFragment = new EmailAddressPickerFragment();
          break;
        }

      case ContactsRequest.ACTION_CREATE_SHORTCUT_CALL:
        {
          PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
          fragment.setShortcutAction(Intent.ACTION_CALL);

          mListFragment = fragment;
          break;
        }

      case ContactsRequest.ACTION_CREATE_SHORTCUT_SMS:
        {
          PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
          fragment.setShortcutAction(Intent.ACTION_SENDTO);
          mListFragment = fragment;
          break;
        }

        //            case ContactsRequest.ACTION_PICK_POSTAL: {
        //                PostalAddressPickerFragment fragment = new PostalAddressPickerFragment();
        //                mListFragment = fragment;
        //                break;
        //            }

      default:
        throw new IllegalStateException("Invalid action code: " + mActionCode);
    }

    mListFragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
    mListFragment.setDirectoryResultLimit(DEFAULT_DIRECTORY_RESULT_LIMIT);

    getFragmentManager()
        .beginTransaction()
        .replace(R.id.list_container, mListFragment)
        .commitAllowingStateLoss();
  }