FileDocCategorySizeDatePackage
AlarmController.javaAPI DocGoogle Android v1.5 Example6352Sun Nov 11 13:01:04 GMT 2007com.google.android.samples.app

AlarmController

public class AlarmController extends android.app.Activity
Example of scheduling one-shot and repeating alarms. See {@link OneShotAlarm} for the code run when the one-shot alarm goes off, and {@link RepeatingAlarm} for the code run when the repeating alarm goes off.

Demo

App/Service/Alarm Controller

Source files

src/com/google/android/samples/app/AlarmController.java The activity that lets you schedule alarms
src/com/google/android/samples/app/OneShotAlarm.java This is an intent receiver that executes when the one-shot alarm goes off
src/com/google/android/samples/app/RepeatingAlarm.java This is an intent receiver that executes when the repeating alarm goes off
/res/any/layout/alarm_controller.xml Defines contents of the screen

Fields Summary
private android.view.View.OnClickListener
mOneShotListener
private android.view.View.OnClickListener
mStartRepeatingListener
private android.view.View.OnClickListener
mStopRepeatingListener
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        setContentView(R.layout.alarm_controller);

        // Watch for button clicks.
        Button button = (Button)findViewById(R.id.one_shot);
        button.setOnClickListener(mOneShotListener);
        button = (Button)findViewById(R.id.start_repeating);
        button.setOnClickListener(mStartRepeatingListener);
        button = (Button)findViewById(R.id.stop_repeating);
        button.setOnClickListener(mStopRepeatingListener);