FileDocCategorySizeDatePackage
AlarmController.javaAPI DocAndroid 1.5 API6856Wed May 06 22:41:08 BST 2009com.example.android.apis.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.example.android.apis/app/AlarmController.java The activity that lets you schedule alarms
src/com.example.android.apis/app/OneShotAlarm.java This is an intent receiver that executes when the one-shot alarm goes off
src/com.example.android.apis/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
android.widget.Toast
mToast
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 savedInstanceState)

        super.onCreate(savedInstanceState);

        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);