At some point I want my Service to execute something after 2 seconds. So - I had prepared a designated Handler:
private Handler handler;
...
HandlerThread thread = new HandlerThread("LNT");
thread.start();
handler = new Handler(thread.getLooper());
and then I call
handle.postDelayed (new Runnable(){
public void run(){
doSomething();
}, (long)(2000));
sometimes soSomething() is being called after 2 seconds, but many times it take up to 15 seconds !!
What am I doing wrong? Is there another way to run something after a specific period of time