노티피케이션을 띄우고 시간의 흐름을 표시해주고싶어서 아래와 같이 1초마다 갱신하려고 하니,,
노티피케이션이 갱신은되는데,, 텍스트만 바뀌는게 아니라 노티피케이션 전체가 새로바뀌더군요..
저는 텍스트만 계속 바꿔주고 싶은데 어떻게 해야하나요?
int interval = 0;
CountDownTimer timer = new CountDownTimer(3600 * 1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
interval++;
String time = String.format("%02d", (interval/60)%60) + ":" + String.format("%02d", interval%60);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setContentTitle("Notification Update Test")
.setContentText(time)
.setTicker("Notification Update Test")
Notification notification = builder.build();
notificationManager.notify(8888, notification);
}
@Override
public void onFinish() {
//
}
};
timer .start();