Java tutorial
//package com.java2s; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; public class Main { public static void notify(Context context, String msg, String title, Class<?> toClz, int notifyId) { PendingIntent pend = PendingIntent.getActivity(context, 0, new Intent(context, toClz), 0); Notification.Builder builder = new Notification.Builder(context); int icon = context.getApplicationInfo().icon; builder.setContentIntent(pend).setSmallIcon(icon).setWhen(System.currentTimeMillis()).setTicker(msg) .setContentTitle(title).setContentText(msg).setAutoCancel(true); NotificationManager man = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); man.notify(notifyId, builder.getNotification()); } }