作者hhhhomerun (homerun)
看板AndroidDev
標題[問題] Notification的時間設定
時間Sat Sep 3 11:35:29 2011
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlarmManager alarms=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent intent=new Intent(this,NotificationService.class);
PendingIntent pendingIntent=PendingIntent.getService(this,0,intent,PendingIntent.FLAG_ONE_SHOT);
alarms.set(AlarmManager.RTC_WAKEUP,
System.currentTimeMillis(),pendingIntent);
}
}
不好意思不才是Android的新手
想要練習做一個待辦事項可以設定時間提醒的小程式
上網找到一段程式碼 它設定的是馬上啟動
我卻不曉得該怎麼設定我想要的時間
要改的應該是這段嗎? System.currentTimeMillis()
比如我要設定在2011年10月10日 該怎麼修改呢
勞煩各位先輩指導 謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.192.3.174
推 kiedveian:Calendar.getInstance().set(2011,10,10) 09/03 12:59
→ sjrom: ↑9,月是0 based. 09/03 14:25
→ hhhhomerun:謝謝T___T~ 09/03 15:24
推 kiedveian:年也要減1900... 111 09/03 21:19