I'm a beginner in Android.
I made a simple code where I want to display a sequence of "hello 1", "hello 2"..."hello 5" in a textView with the step of 1 sec. However,every time only the last "hello 5" appears. Can anyone help me to modify my code to show in the textView all the intermediate words changing each other with 1-sec pause (from "hello 1" to "hello 5").
Thank you in advance!
View.OnClickListener onClickListener_button1 = new View.OnClickListener() {
@Override
public void onClick(View v) {
for(int i=1; i<= 5; i++){
textView.setText("hello " + i);
try{Thread.sleep(1000);
} catch(Exception e){
}
}
}