文件名称:Android 创建备忘录及闹铃提醒的例子.rar
文件大小:71KB
文件格式:RAR
更新时间:2022-07-30 05:03:59
Android源码-系统相关
Android 创建备忘录的例子,可自定义备忘录内容,自定义时间和自定义提醒闹钟的类型、铃声等。相关代码: c.setTimeInMillis(System.currentTimeMillis());//设置当前时间 c.set(Calendar.HOUR_OF_DAY, hourOfDay);//设置小时 c.set(Calendar.MINUTE, minute);//设置分钟 c.set(Calendar.SECOND, 0);//设置秒 c.set(Calendar.MILLISECOND, 0);//设置毫秒 Intent intent=new Intent(Sample6_12_Activity.this,AlarmReceiver.class);//运行AlarmReceiver类 PendingIntent pi=PendingIntent.getBroadcast(//创建PendingIntent对象 Sample6_12_Activity.this, 0, intent, 0); AlarmManager alarm=(AlarmManager)Sample6_12_Activity.this.getSystemService(ALARM_SERVICE); alarm.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi);//设置闹钟提醒一次 alarm.setRepeating(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), 120000, pi);//每两分钟提醒一次 String tempHour=(hourOfDay "").length()>1?hourOfDay "":"0" hourOfDay; String tempMinute=(minute "").length()>1?minute "":"0" minute;
【文件预览】:
codesc.net
----com.bn.chap6.alarm.Sample6_12_Activity()
--------.project(846B)
--------project.properties(562B)
--------src()
--------AndroidManifest.xml(733B)
--------res()
--------.settings()
--------assets()
--------gen()
--------.classpath(364B)
--------bin()