Android examples for Android OS:Notification
set Normal Notification
//package com.java2s; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.support.v4.app.NotificationCompat; public class Main { public static void setNormalNotification(Context context, String title, String content, String ticker, int num, int sIcon, Bitmap bIcon, Class<?> cls) { NotificationManager manager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( context);//from w ww . j a v a2s .co m mBuilder.setContentTitle(title); mBuilder.setContentText(content); mBuilder.setNumber(num); mBuilder.setSmallIcon(sIcon); mBuilder.setLargeIcon(bIcon); // mBuilder.setTicker(ticker); // ? mBuilder.setAutoCancel(true); Intent intent = new Intent(context, cls); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(pendingIntent); manager.notify(0, mBuilder.build()); } }