예제 #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.action_deliver_stat_option) {
      Intent intent = new Intent(getActivity(), DeliverStatOptionActivity.class);
      intent.putExtra(EXTRA_STAT_INTERVAL, mModel.getInterval());
      startActivityForResult(intent, REQUEST_CODE_SET_INTERVAL);

      Preferences.setStatType(mStatType);
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
예제 #2
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Logger.d(
        LOG_TAG, "onActivityResult, requestCode = " + requestCode + ", resultCode = " + resultCode);

    if (requestCode == REQUEST_CODE_SET_INTERVAL && resultCode == Activity.RESULT_OK) {
      String[] interval = data.getStringArrayExtra(EXTRA_STAT_INTERVAL);
      Logger.d(LOG_TAG, "onActivityResult, interval = " + Arrays.toString(interval));

      mModel.setInterval(interval);
      return;
    }
    super.onActivityResult(requestCode, resultCode, data);
  }