I tried to print a message that is changing in a textwiew. The problem when I did this is that the app is waiting the end of the loop to put the result.
public class Testloop extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_testloop);
String message = "test : ";
for(int x = 1; x < 20; x = x + 1) {
message +=x;
int timeInMills = 1000; // time in ms
SystemClock.sleep(timeInMills);
TextView textView = (TextView) findViewById(R.id.txte);
textView.setText(message);
}
}