Change variable from the button of a notification

0

This is the method that shows the notifications, what I want is that when one of the two notification buttons is changed, one of the global variables of the class in which that method is, that is, the dale to one of its two buttons that an int passes for example from 0 to 1

 public void showNotification() {

    Intent notificationIntent = new Intent(this, Login.class);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

    Notification notification  = new Notification.Builder(this)
            .setCategory(Notification.CATEGORY_MESSAGE)
            .setContentTitle("title")
            .setContentText("text")
            .setOngoing(true)
            .setSmallIcon(R.drawable.ic_launcher_background)
            .setAutoCancel(false)


            .addAction(android.R.drawable.ic_menu_view, "View details", contentIntent)
            .addAction(android.R.drawable.ic_menu_view, "View details", contentIntent)
            .setContentIntent(contentIntent)



            .setVisibility(Notification.VISIBILITY_PUBLIC)
            .build();
    NotificationManager notificationManager =
            (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    notificationManager.notify(1, notification );
}
    
asked by Aurelio Fernandez 16.04.2018 в 14:18
source

0 answers