-1

I'm working on an android application.

I have a chronometer (timer) that is started by clicking a button.

What I want is a toast to be displayed every hour saying an hour has passed (or every minute for testing).

I understand that I need to use a combination of intents, recievers and broadcast recievers however I'm stuck on what code to use.

Can somebody please help me with the code to perform the function required?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rob
  • 17
  • 4
  • Either of the options below will work, however; for your chronometer, if its necessary, you should go with SatishBabu's claim.. problem is if your Activity leaves, the chronometer won't be running if its in the Activity. – JoxTraex Feb 02 '12 at 13:07
  • thanks for the replies. Can anybody provide a code example, I'm relatively new to android and Java? – Rob Feb 02 '12 at 13:26
  • Just google it.. ChronoMeter Example.. you'll find a ton of them. Dont be so scared to venture out and search for things on your own. This is how learning takes place. – JoxTraex Feb 02 '12 at 13:28
  • I have done, struggled to find anything where actions are performed at intervals – Rob Feb 02 '12 at 13:36

2 Answers2

1

Use setOnChronometerTickListener (Chronometer.OnChronometerTickListener listener)

refer http://developer.android.com/reference/android/widget/Chronometer.html#setOnChronometerTickListener(android.widget.Chronometer.OnChronometerTickListener)

SathishBabu S
  • 382
  • 3
  • 11
0

Just Start an alarm using an AlarmManager that will send an intent to a service that will display a Toast.

Update

Create an incrementing timer in seconds in 00:00 format?

I'd recommend trying both options to see which you like better.

Community
  • 1
  • 1
JoxTraex
  • 13,423
  • 6
  • 32
  • 45