show Notification With Style - Android Android OS

Android examples for Android OS:Notification Show

Description

show Notification With Style

Demo Code

// Use of this source code is governed by the MIT license that can be found
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.NotificationCompat.WearableExtender;
import android.support.v4.app.RemoteInput;

public class Main{
    private static void showNotificationWithStyle(Context context, int id,
            NotificationCompat.Style style) {
        NotificationManagerCompat.from(context).notify(
                id,//  ww w .  j av a 2s  .  c  om
                new NotificationCompat.Builder(context)
                        .setSmallIcon(R.drawable.ic_launcher)
                        .setStyle(style).build());
    }
}

Related Tutorials