示例#1
0
  // @Override
  public View getView(int inPos, View vwConvert, ViewGroup parent) {
    View vwView;
    if (vwConvert == null) {
      vwView = mInflater.inflate(R.layout.history_item, parent, false);
    } else {
      vwView = vwConvert;
    }

    TextView txtvExpr = (TextView) vwView.findViewById(R.id.historyExpr);
    TextView txtvResult = (TextView) vwView.findViewById(R.id.historyResult);

    HistoryEntry entry = mEntries.elementAt(inPos);
    String base = entry.getBase();
    txtvExpr.setText(entry.getBase());

    try {
      String strRes = mEval.evaluate(base);
      txtvResult.setText("= " + strRes);
    } catch (SyntaxException e) {
      txtvResult.setText("");
    }

    return vwView;
  }
示例#2
0
  public View getView(int position, View convertView, ViewGroup parent) {
    View view;
    if (convertView == null) {
      view = mInflater.inflate(R.layout.history_item, parent, false);
    } else {
      view = convertView;
    }

    TextView expr = (TextView) view.findViewById(R.id.historyExpr);
    TextView result = (TextView) view.findViewById(R.id.historyResult);

    HistoryEntry entry = mEntries.elementAt(position);
    String base = entry.getBase();
    expr.setText(entry.getBase());

    try {
      String res = mEval.evaluate(base);
      result.setText("= " + res);
    } catch (SyntaxException e) {
      result.setText("");
    }

    return view;
  }