package info.liuqy.adc.tomatoclock;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.view.View;
import android.widget.Toast;
public class TomatoClockActivity extends Activity {
public static final int VIBRATE_ACTION = 0;
public static final long FIFTEEN_MIN = 5*1000; //FIXME demo only
private TimerUpdateService srv = null;
private ServiceConnection conn = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder binder) {
srv = ((TimerUpdateService.MyBinder)binder).getService();
}
public void onServiceDisconnected(ComponentName className) {
srv = null;
}
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void startTimer(View view) {
Intent i = new Intent(this, TomatoVibrator.class);
PendingIntent pi = PendingIntent.getBroadcast(
this.getApplicationContext(), VIBRATE_ACTION, i, 0);
AlarmManager am = (AlarmManager)this.getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + FIFTEEN_MIN, pi);
Toast.makeText(this, "TomatoTimer started!", Toast.LENGTH_SHORT).show();
Intent service = new Intent(this, TimerUpdateService.class);
bindService(service, conn, Context.BIND_AUTO_CREATE);
}
}
简单的android闹钟源代码
4星 · 超过85%的资源 需积分: 10 50 浏览量
2012-03-01
00:32:51
上传
评论 18
收藏 119KB ZIP 举报
快乐由我
- 粉丝: 5
- 资源: 35
最新资源
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
- 音乐展示网页、基于Stenography的图像数字水印添加与提取,以及基于颜色矩和Tamura算法的图像相似度评估算法py源码
- 基于EmguCV(OpenCV .net封装),图像数字水印加解密算法的实现,其中包含最低有效位算法,离散傅里叶变换算法+文档书
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
- 6
前往页