I am trying to build a simple calculator to learn Android programming. I've got my UI all sorted but the "Submit" button doesn't seem to be working, which should do logic on two user submitted values and output the result.
Here is the method:
@Override
public void onClick(View view){
String num1 = etfirst.getText().toString();
String num2 = etsecond.getText().toString();
String amount = etamount.getText().toString();
switch(view.getId()){
case R.id.btnSubmit:
int divide = (Integer.parseInt(num2) / Integer.parseInt(num1)) +1;
int multiply = divide * Integer.parseInt(amount);
tvResult.setText(String.valueOf(multiply));
break;
}
}
I've declared all my variables before hand and initialized them. All variable names match but the ID of the elements in the UI so I'm not sure what the problem is.
Here is the logcat as requested: https://i.stack.imgur.com/6RurY.png. Posted to Imgur as 10 reputation is needed to post images.