1. Are you ready for the Galaxy S20? Here is everything we know so far!

Unable to add action button to notification message

Discussion in 'Android Development' started by AKA001, Feb 10, 2016.

  1. AKA001

    AKA001 Newbie
    Thread Starter

    Hello All,

    I have been trying to add an action button to the notification message, but it is not showing up. Also, any change i am making to customise the notification message is not taking effect for e.g.. set lights, big text etc:



    Intent notificationIntent1 = new Intent( context, null );

    PendingIntent contentIntent1 = PendingIntent.getActivity(context, 0, null, 0);;

    ///


    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder( context );

    notificationBuilder.setSmallIcon(appIcon);

    notificationBuilder.setTicker(tickerText);

    notificationBuilder.setWhen(System.currentTimeMillis());

    notificationBuilder.setContentTitle(contentTitle);

    notificationBuilder.setContentText("testing");

    notificationBuilder.setAutoCancel(true);

    notificationBuilder.setContentIntent(contentIntent);



    notificationBuilder.setStyle(new NotificationCompat.BigTextStyle());

    notificationBuilder.addAction(new NotificationCompat.Action(R.drawable.icon, "futher",contentIntent1));

    // notificationBuilder.addAction(R.drawable.icon,"test", PendingIntent.getActivity(context, 0,notificationIntent1, 0, null) );

    Notification notification = notificationBuilder.build();



    NotificationManager notificationManager = (NotificationManager) context.getSystemService( Context.NOTIFICATION_SERVICE );

    notificationManager.notify( 0, notification );

    Appreciate your assistance in advance
     



    1. Download the Forums for Android™ app!


      Download

       
  2. scary alien

    scary alien not really so scary
    VIP Member

    Welcome to our AndroidForums, @AKA001.

    I've moved your thread over here to our Application Development area for you where you'll get more appropriate views and replies.

    Cheers!
     
Loading...
Similar Threads - Unable add action
  1. MarcoGalaxyA10
    Replies:
    1
    Views:
    505
  2. FaustBottomText
    Replies:
    3
    Views:
    646
  3. xarzu
    Replies:
    2
    Views:
    720
  4. GlitchedFolx
    Replies:
    16
    Views:
    2,101
  5. aj4yourhelp
    Replies:
    0
    Views:
    872
  6. Ian Preddy
    Replies:
    13
    Views:
    4,082
  7. Magixsword
    Replies:
    0
    Views:
    868
  8. kumaranil13k
    Replies:
    0
    Views:
    2,327
  9. dakshay95
    Replies:
    3
    Views:
    2,493
  10. Sindhi Apps
    Replies:
    0
    Views:
    1,624

Share This Page

Loading...