Reputation: 109
I don't get the new line using the code below.
Can anyone tell me how to fix this?
String sum="";
int input = Integer.parseInt(value.getText().toString());
for (int i = 0; i < 10; i++) {
sum += i + input;
display.setText(sum+"\n");
}
Upvotes: 0
Views: 197
Reputation: 38098
This is how it should work:
String sum="";
int input = Integer.parseInt(value.getText().toString());
for (int i = 0; i < 10; i++)
{
sum += i + input + "\n";
}
display.setText(sum);
Add the \n
inside the loop.
Then display the whole string after the loop has completed.
Upvotes: 1