send Notification No Action - Android Android OS

Android examples for Android OS:Notification

Description

send Notification No Action

Demo Code


//package com.java2s;

import android.app.NotificationManager;

import android.content.Context;

import android.support.v4.app.NotificationCompat;

public class Main {
    private static int notificationId;

    public static void sendNotificationNoAction(Context context) {
        NotificationCompat.Builder builder = new NotificationCompat.Builder(
                context).setSmallIcon(android.R.drawable.ic_menu_more)
                .setContentTitle("This notification has no action")
                .setContentText("test test test");
        NotificationManager m = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        m.notify(notificationId, builder.build());
        notificationId++;//w  ww  .j  a  v a 2 s . c o m
    }
}

Related Tutorials