over 9 years ago
If you are looking to apply the big view style to a notification, here is the solution you are looking for:-
- Uri notificationsound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
- String notificationText;
- NotificationManager mNotificationManager;
- int NOTIFICATION_ID;
- notificationText = "This is the notification long message "+
- "that will cover more than two lines in the notification." +
- "This is just the part of our example " ;
- NOTIFICATION_ID = (int) (System.currentTimeMillis());
- mNotificationManager = (NotificationManager)
- this.getSystemService(Context.NOTIFICATION_SERVICE);
- final Notification.Builder builder = new Notification.Builder(this);
- builder.setStyle(new Notification.BigTextStyle(builder)
- .bigText(notificationText)
- .setBigContentTitle("NotificationTitle")
- .setSummaryText("Big summary"))
- .setContentTitle("Title")
- .setContentText("Hello this is the context text")
- .setSmallIcon(R.drawable.logo);
- mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
Uri notificationsound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); String notificationText; NotificationManager mNotificationManager; int NOTIFICATION_ID; notificationText = "This is the notification long message "+ "that will cover more than two lines in the notification." + "This is just the part of our example " ; NOTIFICATION_ID = (int) (System.currentTimeMillis()); mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); final Notification.Builder builder = new Notification.Builder(this); builder.setStyle(new Notification.BigTextStyle(builder) .bigText(notificationText) .setBigContentTitle("NotificationTitle") .setSummaryText("Big summary")) .setContentTitle("Title") .setContentText("Hello this is the context text") .setSmallIcon(R.drawable.logo); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
0 Comment(s)