@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getArguments() != null && getArguments().containsKey(ARG_URI_DATA)) {
      mUriData = (UriData) getArguments().getSerializable(ARG_URI_DATA);
    } else {
      mUriData = new UriData();
    }
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.db_menu, menu);

    prepareSearch(menu, inflater);
    mSearchView.setQueryHint(getSearchHint(mUriData));

    if (mUriData.targetType == UriData.TYPE_IR_CODE) {
      menu.findItem(R.id.menu_db_save).setVisible(true);
    }
  }
  @Override
  public void onPause() {
    cancelDialog();

    // SearchView is so crappy that invalidateOptionsMenu will
    // not remove the keyboard, we have to use this "hack"
    // The null check is because the user could presses back very quickly
    if (mSearchView != null) {
      mSearchView.setQuery("", false);
      mSearchView.clearFocus();
    }

    super.onPause();
  }