int NOTIF_ID = 9;
protected void showNotification(String Spelling) {
Context context = getApplicationContext();
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
long when = System.currentTimeMillis();
Notification notification = new Notification(R.drawable.genera36, "Times to read Spellings", when);
Intent notificationIntent = new Intent(this, TodaysSpellingsActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context,"Spelling: "+Spelling, "",contentIntent);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
nm.notify(NOTIF_ID++, notification);
}
No comments:
Post a Comment