コード例 #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.showQA) {
      Intent intent = new Intent(this, QAActivity.class);
      startActivity(intent);
      return true;
    }
    if (id == R.id.logout) {
      sqaApp.logout(this);
      return true;
    }
    if (id == R.id.help) {
      HelpDialogFragment fdf = HelpDialogFragment.newInstance(HelpDialogFragment.CONTENT_HIGHSCORE);
      fdf.show(getFragmentManager(), "help");
      return true;
    }
    if (id == R.id.about) {
      AboutDialogFragment adf = new AboutDialogFragment();
      adf.show(getFragmentManager(), "about");
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
コード例 #2
0
  @Override
  public boolean onOptionsItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        finish();
        return true;

      case R.id.send_coins_options_help:
        HelpDialogFragment.page(getSupportFragmentManager(), R.string.help_send_coins);
        return true;
    }

    return super.onOptionsItemSelected(item);
  }