postDelayed
is non blocking, meaning it would add it to a queue of I'll do this later. So what you are probably seeing is all text updates happening together at the 7th second. I say this because you are postDelay
ing from the onCreate
method when in reality you probably want to do it from onResume
or even onPostResume
.
Also there is no reason to create a thread to add runnables to the post queue. Your code should look more like this: (Note the time to delay multiplier)
@Override
protected void onResume() {
super.onResume();
for (int count = 0; count < arraylength; count++){
handler.postDelayed(new Runnable(){
@Override
public void run() {
mytexts.setText(myarray[count]);
}
}, 7000 * (count + 1));
}
}