我創建了一個通知與延遲發射,進行與Handler.postdelay停止運行與postdelay(安卓)處理
現在,我希望我的用戶能夠在某處停止這30秒的運行處理過程:
handler.postDelayed(new Runnable() {
public void run() {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(Inlopen.this)
.setSmallIcon(R.drawable.iconsmall)
.setContentTitle("U moet uw voeten controleren!")
.setContentText("Uw moet uw voeten controleren!");
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
mBuilder.setSound(alarmSound);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, mBuilder.build());
}
}, 30000);
如何做到這一點? 我已經搜索了很多,但我無法找到如何做到這一點..
我該在哪裏放置它? – user2971732 2014-11-01 15:40:11
將Runnable與其他變量一起放入。這些電話本身可以在任何你想要的地方發生,只要處理器準備好搖擺和/或滾動。 – 2014-11-01 15:48:54
謝謝!通過你的代碼管理它的工作! – user2971732 2014-11-01 15:54:01