Android For loop

Change as follow:

t+="Num: " + l + "\n";

And the most effective way to do this is to using StringBuilder, Something like:

StringBuilder t = new StringBuilder(); 
for(int l=0; l<=5; l++){
    t.append("Num:");
    t.append(l+"\n");
}

VarPrueba.setText(t.toString());

Leave a Comment