A
A
artshelom2018-01-12 19:32:42
Android
artshelom, 2018-01-12 19:32:42

How to make button click processing in notifications?

Wrote notification code:

PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationCompat.Builder builder =
                new NotificationCompat.Builder(context)
                        .setAutoCancel(true)
                        .setSmallIcon(R.mipmap.ic_launcher)
                        .setContentTitle("1-")
                        .setContentText("Список тем")
                        .addAction(R.drawable.ic_launcher_background, "Назад",pendingIntent)
                        .addAction(R.drawable.ic_launcher_background, "Ок",pendingIntent)
                        .addAction(R.drawable.ic_launcher_background, "Вперед",pendingIntent)
        ;
        Notification notification = builder.build();

        NotificationManager notificationManager =
                (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
        notificationManager.notify(1, notification);

How can I change the PendingIntent so that when the buttons are clicked, the ContentText changes??

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question