Propriété de Albiri Sigue
customer 27921 at Fri Mar 11 19:19:45 +0100 2011
316 L’art du développement Android
});
}
private void notifyMe() {
final NotificationManager mgr=
(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification note=new Notification(R.drawable.red_ball,
"Message d’etat !",
System. currentTimeMillis());
PendingIntent i=PendingIntent.getActivity(this, 0,
new Intent(this, NotifyMessage.class),
0);
note.setLatestEventInfo(this, "Titre de la notification",
"Message de notification", i);
note.number=++count;
mgr.notify(NOTIFY_ME_ID, note);
}
}
Cette activité fournit deux gros boutons, un pour lancer une notification après un délai de
5 secondes, l’autre pour annuler cette notification si elle est active. La Figure 32.1 montre
l’aspect de son interface lorsqu’elle vient d’être lancée.
Figure 32.1
La vue principale de
NotifyDemo.
Livre Android.book Page 316 Dimanche, 8. novembre 2009 12:23 12
Précédent

- 331/391

Suivant