I'm writing an android application which needs to display some text for a a few thousandths of a second, then blank it again. What I have now is it displaying the text, then using Thread.sleep, then setting the text back to null. Instead, what happens is, when I press the button, the app hangs for the set amount of time, the text never appears, and the logcat says "Skipped xxx frames! The application may be doing too much work on its main thread." What is going on, and is there a better way of doing things?
Try using a runnable.
private Handler mHandler = new Handler();
//code to make text appear...
mHandler.postDelayed(makeTextDisapear , 3000); // Replace 3000 with the number of milliseconds you want the text to display.
private Runnable makeTextDisapear = new Runnable() {
public void run() {
// code to make text dissapear
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With