use of com.sfeir.calc.CalcEngineImpl in project jhybrid by Sfeir.
the class DisplayResultActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String expr = intent.getStringExtra(MainActivity.EXPR);
/**
* Call the core library
*/
CalcEngine calcEngine = new CalcEngineImpl();
int evaluate = calcEngine.evaluate(expr);
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText("" + evaluate);
setContentView(textView);
}
use of com.sfeir.calc.CalcEngineImpl in project jhybrid by Sfeir.
the class Calc method clicButton.
@UiHandler("button")
void clicButton(ClickEvent event) {
CalcEngineImpl calcEngine = new CalcEngineImpl();
String expr = text.getText();
int result = calcEngine.evaluate(expr);
label.setText("" + result);
}
Aggregations