public void setResult(double result) {
   this.result = result;
   myCalculator.clear();
   myCalculator.setResult(result);
   tv_calcuresult.setText(MyUtil.doubleFormate(result));
   btn_ok.setText("OK");
 }
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.button0:
        myCalculator.pressNum("0");
        break;
      case R.id.button1:
        myCalculator.pressNum("1");
        break;
      case R.id.button2:
        myCalculator.pressNum("2");
        break;
      case R.id.button3:
        myCalculator.pressNum("3");
        break;
      case R.id.button4:
        myCalculator.pressNum("4");
        break;
      case R.id.button5:
        myCalculator.pressNum("5");
        break;
      case R.id.button6:
        myCalculator.pressNum("6");
        break;
      case R.id.button7:
        myCalculator.pressNum("7");
        break;
      case R.id.button8:
        myCalculator.pressNum("8");
        break;
      case R.id.button9:
        myCalculator.pressNum("9");
        break;
      case R.id.buttonc:
        myCalculator.pressClear();
        break;
      case R.id.buttondot:
        myCalculator.pressDot();
        break;
      case R.id.buttonadd:
        myCalculator.count(ADD);
        break;
      case R.id.buttondec:
        myCalculator.count(DEC);
        break;
      case R.id.buttonok:
        if ("=".equals(btn_ok.getText().toString())) myCalculator.count();
        break;

      default:
        break;
    }
    // 设置ok键状态
    switch (v.getId()) {
      case R.id.buttonadd:
      case R.id.buttondec:
        btn_ok.setText("=");
        break;

      case R.id.buttonok:
        if ("=".equals(btn_ok.getText().toString())) {
          btn_ok.setText("OK");
        } else {
          // TODO 关闭界面,保存值,调用activity方法
          if (getActivity() instanceof BudgetSecActivity) {
            Log.e(
                "CalculateSimpleFragment",
                "save:" + tv_calcuresult.getText() + ";" + myCalculator.getResult());
            ((BudgetSecActivity) getActivity())
                .save(MyUtil.String2double(tv_calcuresult.getText().toString()));
          }
        }
        break;

      default:
        break;
    }
  }