if (buttonText.equals("C")) {
if (dataToCalculate == null || dataToCalculate.isEmpty()) {
Toast.makeText(this, "No values to delete", Toast.LENGTH_SHORT).show();
resultTv.setText("0");
} else {
if (dataToCalculate.length() > 1) {
dataToCalculate = dataToCalculate.substring(0, dataToCalculate.length() - 1);
} else {
dataToCalculate = ""; // Clear if only one character remains
resultTv.setText("0");
}
solutionTv.setText(dataToCalculate);
if (!dataToCalculate.isEmpty()) {
String finalResult = getResult(dataToCalculate);
if (finalResult.isEmpty() || finalResult.equals("Err")) {
resultTv.setText("0");
} else {
resultTv.setText(finalResult);
}
} else {
resultTv.setText("0");
}
return;
need help with the above Java code, where I need to fix the issue that the code is taking “C” as input when no values are present.