Skip to content

khalid-mahmood/NotificationCompat

 
 

Repository files navigation

Samples of NotificationCompat

Simple Samples for creating Beautiful Notification with NotificationCompat. - Android Development Patterns Ep 2

Heres is the link to Episode 2 NotificationCompat Video.

NotificationCompat is the 2nd ep, of the serie: Android Development Patterns.

Android Development Patterns playlist here

Heres is the link to Android Developers Channel.

Screenshots

MainLayout NotificationLayer1 NotificationLayer2

Sample Code

-- private void sendNotificationBigPictureStyle(Activity activity){

    NotificationCompat.Builder builder = new NotificationCompat.Builder(activity);
    builder.setSmallIcon(R.drawable.ic_whatshot_black_24dp);

    Bitmap profilePicture = BitmapFactory.decodeResource(
            activity.getResources(),
            R.drawable.profile_luz
    );

    Bitmap bigPicture = BitmapFactory.decodeResource(
            activity.getResources(),
            R.drawable.big_picture
    );

    NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle();
    style.bigPicture(bigPicture);
    style.setBigContentTitle("New picture from Luz");
    style.setSummaryText("Science is awesome, look at.");
    style.bigLargeIcon(profilePicture);
    builder.setStyle(style);

    Notification notification = builder.build();
    NotificationManagerCompat.from(activity).notify(NOTIFICATION_ID + 4, notification);

}

--

About

NotificationCompat Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%