PavanMysore
PavanMysore

Reputation: 189

Handler behavior in Android

I am creating an handler as shown below,

postTimer = new Handler();
postHandler = new Runnable() {
   public void run() {
 Message msg = mServiceHandler.obtainMessage();
 msg.arg1 = SYNC_USAGE_STAT;
 mServiceHandler.sendMessage(msg);              
}
};
postTimer.postDelayed(postHandler, 15000);

Does this give a single timeout or is it like heartbeat.

Upvotes: 1

Views: 238

Answers (1)

Alex Orlov
Alex Orlov

Reputation: 18107

That's a one time event. You can do the same thing in your runnable (postTimer.postDelayed(postHandler, 15000); I mean), so it will behave like heartbeat, but you would need some kind of flag to stop it somewhere in the future.

Upvotes: 1

Related Questions