I built one AsyncTask class that returns a specific value. This value changes frequently, so, I need to call my AsyncTask class multiple times to show the value updated.
I'm getting on a different class the result from the AsyncTask.
try {
output = new task().execute(getconversationid).get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
And when the result from the AsyncTask updates, I call my other Class again to update everything.
private void call() {
new GetContacts().execute(id);
}
...
mobilemessages = contacts.length();
...
myNum = Integer.parseInt(output);
if(myNum != mobilemessages) {
call();
}
My question is how can i set a Timer or a Handler to update my class call(task) every three seconds?
Thank you.