Вот функция, в которой я создаю уведомление< /p>
Код: Выделить всё
private void createNotification() {
Intent intent = new Intent(this, RateDia.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
RemoteViews layoutNotificacio = new RemoteViews(getPackageName(), R.layout.notificacio_gran);
layoutNotificacio.setImageViewBitmap(R.id.imatge1, BitmapFactory.decodeResource(getResources(), R.drawable.e01_grinning_face));
layoutNotificacio.setImageViewBitmap(R.id.imatge2, BitmapFactory.decodeResource(getResources(), R.drawable.e02_grimacing_face));
layoutNotificacio.setImageViewBitmap(R.id.imatge3, BitmapFactory.decodeResource(getResources(), R.drawable.e03_grinning_face_with_smiling_eyes));
layoutNotificacio.setImageViewBitmap(R.id.imatge4, BitmapFactory.decodeResource(getResources(), R.drawable.e04_face_with_tears_of_joy));
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.mimismo_icono_notificacio)
.setContentTitle("Notificación de miMismo")
.setCustomBigContentView(layoutNotificacio)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(pendingIntent)
.setAutoCancel(true);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
notificationManager.notify(NOTIFICATION_ID, builder.build());
}
}
Код: Выделить всё
Как вы можете видите, таких строк 4:
Код: Выделить всё
layoutNotificacio.setImageViewBitmap(R.id.imatge1, BitmapFactory.decodeResource(getResources(), R.drawable.e01_grinning_face));Буду признателен за любую помощь.
Подробнее здесь: https://stackoverflow.com/questions/791 ... emoteviews
Мобильная версия