Program: 39362
Project: 39362
Buggy source:
@Override protected void initWidget(){
  mTvAccountName=(TextView)findViewById(R.id.account_name);
  mTvAccountTypeDesc=(TextView)findViewById(R.id.account_type_desc);
  mTvAccountRemark=(TextView)findViewById(R.id.account_remark);
  mIgAccountType=(ImageView)findViewById(R.id.account_type_icon);
  mTvAccountMoney=(TextView)findViewById(R.id.account_money);
  getSupportActionBar().setTitle(mAccountID == 0 ? getResources().getString(R.string.create_account) : getResources().getString(R.string.edit_account));
  if (mAccountID > 0) {
    AccountDetailDO account=accountManager.getAccountByID(mAccountID);
    accountName=account.getAccountName();
    accountRemark=account.getAccountRemark();
    mTvAccountName.setText(accountName);
    accountTypeId=account.getAccountTypeID();
    mTvAccountTypeDesc.setText(account.getAccountDesc());
    mIgAccountType.setImageResource(IconTypeUtil.getAccountIcon(account.getAccountIcon()));
    if (!TextUtils.isEmpty(account.getAccountColor())) {
      mIgAccountType.setColorFilter(Integer.parseInt(account.getAccountColor()));
    }
    mTvAccountRemark.setText(accountRemark);
    accountMoney=account.getAccountMoney();
    mTvAccountMoney.setText(String.format(getResources().getString(R.string.money_format),accountMoney));
  }
  mSubmitButton=(FloatingActionButton)findViewById(R.id.submit);
  mSubmitButton.setImageResource(mAccountID > 0 ? R.drawable.ic_delete_white : R.drawable.ic_done_white);
  mSubmitButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mSubmitButton.setClickable(false);
      if (mAccountID > 0) {
        final MaterialDialog materialDialog=new MaterialDialog(CreateOrEditAccountActivity.this);
        materialDialog.setTitle(getResources().getString(R.string.delete_account)).setMessage("String_Node_Str").setPositiveButton(getResources().getString(R.string.ok),new View.OnClickListener(){
          @Override public void onClick(          View v){
            if (accountCount == 1) {
              materialDialog.dismiss();
              SnackBarUtil.showSnackInfo(mSubmitButton,CreateOrEditAccountActivity.this,getResources().getString(R.string.retain_at_least_one_account));
              return;
            }
            accountManager.deleteAccountByID(mAccountID,new Handler(){
              @Override public void handleMessage(              Message msg){
                super.handleMessage(msg);
                if (msg.what == Constant.MSG_SUCCESS) {
                  setResult(RESULT_OK);
                  finish();
                }
              }
            }
);
          }
        }
).setNegativeButton(getResources().getString(R.string.cancel),new View.OnClickListener(){
          @Override public void onClick(          View v){
            materialDialog.dismiss();
          }
        }
).show();
      }
 else {
        if (TextUtils.isEmpty(accountName)) {
          SnackBarUtil.showSnackInfo(v,CreateOrEditAccountActivity.this,getResources().getString(R.string.enter_account_name));
          return;
        }
        accountManager.createNewAccount(accountName,accountMoney,accountTypeId,accountRemark,accountColor,new Handler(){
          @Override public void handleMessage(          Message msg){
            super.handleMessage(msg);
            if (msg.what == Constant.MSG_ERROR) {
            }
 else {
              setResult(RESULT_OK);
              finish();
            }
          }
        }
);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void initWidget(){
  mTvAccountName=(TextView)findViewById(R.id.account_name);
  mTvAccountTypeDesc=(TextView)findViewById(R.id.account_type_desc);
  mTvAccountRemark=(TextView)findViewById(R.id.account_remark);
  mIgAccountType=(ImageView)findViewById(R.id.account_type_icon);
  mTvAccountMoney=(TextView)findViewById(R.id.account_money);
  getSupportActionBar().setTitle(mAccountID == 0 ? getResources().getString(R.string.create_account) : getResources().getString(R.string.edit_account));
  if (mAccountID > 0) {
    AccountDetailDO account=accountManager.getAccountByID(mAccountID);
    accountName=account.getAccountName();
    accountRemark=account.getAccountRemark();
    mTvAccountName.setText(accountName);
    accountTypeId=account.getAccountTypeID();
    mTvAccountTypeDesc.setText(account.getAccountDesc());
    mIgAccountType.setImageResource(IconTypeUtil.getAccountIcon(account.getAccountIcon()));
    if (!TextUtils.isEmpty(account.getAccountColor())) {
      mIgAccountType.setColorFilter(Integer.parseInt(account.getAccountColor()));
    }
    mTvAccountRemark.setText(accountRemark);
    accountMoney=account.getAccountMoney();
    mTvAccountMoney.setText(String.format(getResources().getString(R.string.money_format),accountMoney));
  }
 else {
    accountManager.getAccountTypeByID(accountTypeId,new Handler(){
      @Override public void handleMessage(      Message msg){
        super.handleMessage(msg);
        if (msg.what == Constant.MSG_ERROR)         return;
        AccountType accountType=(AccountType)msg.obj;
        mTvAccountTypeDesc.setText(accountType.getAccountDesc());
        mIgAccountType.setImageResource(IconTypeUtil.getAccountIcon(accountType.getAccountIcon()));
      }
    }
);
  }
  mSubmitButton=(FloatingActionButton)findViewById(R.id.submit);
  mSubmitButton.setImageResource(mAccountID > 0 ? R.drawable.ic_delete_white : R.drawable.ic_done_white);
  mSubmitButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mSubmitButton.setClickable(false);
      if (mAccountID > 0) {
        final MaterialDialog materialDialog=new MaterialDialog(CreateOrEditAccountActivity.this);
        materialDialog.setTitle(getResources().getString(R.string.delete_account)).setMessage("String_Node_Str").setPositiveButton(getResources().getString(R.string.ok),new View.OnClickListener(){
          @Override public void onClick(          View v){
            if (accountCount == 1) {
              materialDialog.dismiss();
              SnackBarUtil.showSnackInfo(mSubmitButton,CreateOrEditAccountActivity.this,getResources().getString(R.string.retain_at_least_one_account));
              return;
            }
            accountManager.deleteAccountByID(mAccountID,new Handler(){
              @Override public void handleMessage(              Message msg){
                super.handleMessage(msg);
                if (msg.what == Constant.MSG_SUCCESS) {
                  setResult(RESULT_OK);
                  finish();
                }
              }
            }
);
          }
        }
).setNegativeButton(getResources().getString(R.string.cancel),new View.OnClickListener(){
          @Override public void onClick(          View v){
            materialDialog.dismiss();
          }
        }
).show();
      }
 else {
        if (TextUtils.isEmpty(accountName)) {
          SnackBarUtil.showSnackInfo(v,CreateOrEditAccountActivity.this,getResources().getString(R.string.enter_account_name));
          return;
        }
        accountManager.createNewAccount(accountName,accountMoney,accountTypeId,accountRemark,accountColor,new Handler(){
          @Override public void handleMessage(          Message msg){
            super.handleMessage(msg);
            if (msg.what == Constant.MSG_ERROR) {
            }
 else {
              setResult(RESULT_OK);
              finish();
            }
          }
        }
);
      }
    }
  }
);
}