Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.app.Notification;
import android.app.NotificationManager;

import android.content.Context;

import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;

import android.support.v4.app.NotificationCompat;

public class Main {
    public static final int NOTIFICATION_ID = 20111;

    public static void notifyBig(@NonNull Context context, @NonNull String title, @NonNull String msg,
            @DrawableRes int iconId) {
        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        Notification notification = new NotificationCompat.Builder(context).setAutoCancel(true)
                .setContentTitle(title).setDefaults(Notification.DEFAULT_ALL).setContentText(msg)
                .setSmallIcon(iconId).setStyle(new NotificationCompat.BigTextStyle().setBigContentTitle(title)
                        .setSummaryText(msg).bigText(msg))
                .build();
        notificationManager.notify(NOTIFICATION_ID, notification);
    }
}