Partage
  • Partager sur Facebook
  • Partager sur Twitter

[android] notification avec bouton

    12 octobre 2018 à 7:57:29

    bonjour

    je me suis fait une notification avec des boutons :

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <TextView
            android:text="TITRE" 
    />
    
        <ImageButton
    />
    
        <ImageButton
     />
    
        <ImageButton
     />
    </RelativeLayout>
    RemoteViews notificationLayout = new RemoteViews(getPackageName(), R.layout.notification_record);
                        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, "1")
                                .setSmallIcon()
                                .setContentTitle()
                                .setContentText()
                                .setStyle(new NotificationCompat.DecoratedCustomViewStyle())
                                .setCustomContentView(notificationLayout)
                                .setPriority(NotificationCompat.PRIORITY_DEFAULT);
    
                        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplicationContext());
                        notificationManager.notify(1, mBuilder.build());

    j'aimerais que quand l'utilisateur clique sur un des 3 boutons, il se passe une fonction spécifique en fonction du bouton.

    mais je ne sais pas comment faire...


    • Partager sur Facebook
    • Partager sur Twitter

    [android] notification avec bouton

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown