Original Post
private OnClickListener mClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
if (v.getId() == R.id.btnNext) {
Double taxPercentage = Double.parseDouble(txtTax.getText().toString());
taxMult = ((taxPercentage / 100)+1);
int numPeople = Integer.parseInt(txtPeople.getText().toString()) ;
nameArray = new String[numPeople];
totalArray = new double[numPeople];
while (!(counter == numPeople)){
Intent myIntent = new Intent(RogCalc.this,UserData.class);
RogCalc.this.startActivityForResult(myIntent,1);
counter = counter + 1;
}
txtAmount2.setText("DEBUG");
}
else {
reset();
}
}
}; My question pretty much comes down to this :
txtAmount2.setText("DEBUG"); Why does this code run right when I click the button ? Why doesn't it wait until all the activity's have ran and the while loop has finished ?