I'm trying to reset the seekbar, spinner and textview using a button. With the code I have implemented resets the seekbar and spinner to the position at the first click but it wont reset the textview in the first click. If I click the reset button a second time it will reset the textview.
public void handleReset(View v){
Integer zeroNum = 0, oneNum = 1;
Double Small = 2.99,oneOunce= 0.15;
totalTextView.setText(Double.toString(Small + oneOunce));
sizeSpinner.setSelection(zeroNum) ;
seekbar.setProgress(oneNum);
}
I want everything to reset async.
I found the way how to reset the seekbar, spinner and textview with a button. Look at the code below.
public void handleReset(View v){
String result;
int zeroNum = 0, oneNum = 1;
Double Small = 2.99,oneOunce= 0.15, subTotal;
subTotal = Small + oneOunce;
try{
sizeSpinner.setSelection(zeroNum) ;
flavorSpinner.setSelection(zeroNum);
seekbar.setProgress(oneNum);
peanutsCheckbox.setChecked(false);
mmsCheckbox.setChecked(false);
almondsCheckbox.setChecked(false);
brownieCheckbox.setChecked(false);
strawberriesCheckbox.setChecked(false);
oreosCheckbox.setChecked(false);
gummybearsCheckbox.setChecked(false);
marshmallowsCheckbox.setChecked(false);
}catch (NumberFormatException e){
Toast.makeText(this, "Incorrect key", Toast.LENGTH_SHORT).show();
}finally {
result = numFormat.format(subTotal);
totalTextView.setText(result);
}
}