In my application, I want to update my UI continuously after 2 seconds. Which is the most suitable method to update.
- Timer
- Async task or anything else?
In my application, I want to update my UI continuously after 2 seconds. Which is the most suitable method to update.
Define a Runnable:
private Runnable mRunnable = new Runnable() {
@Override
public void run() {
//Update to your UI
}
};
Inside your continuous thread:
runOnUiThread(mRunnable);