![]() |
|
| Discusión general sobre Android Exclusivo para hablar de Android |
«
Tema Anterior
|
Siguiente tema
»
|
|
Herramientas |
|
#1
|
||||
|
||||
|
boton de accion en una notificacion en android studio kotlin
Hola amigos quiero que mi notificacion tenga un boton Actualizar que cuando lo oprima este ejecute un metodo y actualice el contenido de la notificacion, sale el boton pero cuando le doy no ejecuta nada, este es mi codigo, pero no entiendo como hacer que funcione
Código:
val snoozeIntent = Intent(this, MainActivity::class.java).apply {
action = "" //<- aqui es donde no se que poner para que me ejecute el metodo
putExtra(EXTRA_NOTIFICATION_ID, 0)
}
val snoozePendingIntent: PendingIntent =
PendingIntent.getBroadcast(this, 0, snoozeIntent, 0)
var builder = NotificationCompat.Builder(this, "default")
.setSmallIcon(R.drawable.ic_notificacion)
.setOnlyAlertOnce(true)
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
.setOngoing(true)
.setColor(resources.getColor(R.color.colorAccent))
.setStyle(
NotificationCompat.BigTextStyle()
.bigText(TEXT)
)
.addAction(R.drawable.ic_notificacion, "Actualizar",
snoozePendingIntent)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
|
|
|
| Respuesta |
Estás aquí
|
||||||
|
||||||
«
Tema Anterior
|
Siguiente tema
»
|
|
Hora actual: 18:22:42 (GMT +1)
HTCMania: líderes desde el 2007





