I am trying to create a notification with a large picture with a short line text marked in red, as shown below.

I created a large image, but my resulting text, not included in several lines, fell into one line and was cut from the end. Please help if anyone knew.
the code
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); String title = context.getString(R.string.app_name); Bitmap remotePicture = null; Bitmap appIcon = null; // Create the style object with BigPictureStyle subclass. NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle(); notiStyle.setBigContentTitle(title); notiStyle.setSummaryText(message); try { appIcon = BitmapFactory.decodeResource(context.getResources(), icon); remotePicture = BitmapFactory.decodeStream((InputStream) new URL(image).getContent()); } catch (IOException e) { e.printStackTrace(); } // Add the big picture to the style. if(remotePicture != null) notiStyle.bigPicture(remotePicture); // This ensures that the back button follows the recommended convention for the back key. TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Adds the back stack for the Intent (but not the Intent itself). try { if(in.getData() == null) stackBuilder.addParentStack(Class.forName(in.getComponent().getClassName())); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Adds the Intent that starts the Activity to the top of the stack. stackBuilder.addNextIntent(in); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); Notification noti = new NotificationCompat.Builder(context) .setSmallIcon(icon) .setAutoCancel(true) .setLargeIcon(appIcon) .setContentIntent(resultPendingIntent) .setContentTitle(title) .setContentText(message) .setStyle(remotePicture == null ? null : notiStyle).build(); noti.defaults |= Notification.DEFAULT_LIGHTS; noti.defaults |= Notification.DEFAULT_VIBRATE; noti.defaults |= Notification.DEFAULT_SOUND; noti.flags |= Notification.FLAG_ONLY_ALERT_ONCE; notificationManager.notify(0, noti);
android notifications
kamil
source share