I have a java function that I want to delay in the middle.
frombox.setText(simpchi[rannum] + "\n[" + pinyin[rannum] + "]");
String meaning = meanings[rannum];
try {
Thread.sleep(500);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
e.printStackTrace();
}
tobox.setText(meaning.replace("/", "\n"));
I want the frombox's text to change, then after 0.5 seconds, the tobox's text to change.
However, when executing this, the entire function delays, then the frombox and tobox's text changes at the same time.
What am I doing wrong? Sorry if this is really simple; I'm very new to java.