Change Notification's action icon dynamicallyChange icons in ActionBar dynamicallyGoogle Play app description formattingNavigation Drawer (Google+ vs. YouTube)How change action icons dynamically in android wearAction Bar icon not showing in android action barAndroid: update specific notification from multiple notifications which have remoteviewAndroid notification action icon: Resources not found exceptionchange notification addAction icon and text color without using custom layoutsNot able to change the icon in recyclerview androidSwitch Pause and Continue actions in NotificationCompat action

Is Diceware more secure than a long passphrase?

Where was the County of Thurn und Taxis located?

Co-worker works way more than he should

Why must Chinese maps be obfuscated?

Is there a word for the censored part of a video?

Which big number is bigger?

Who's the random kid standing in the gathering at the end?

What does "function" actually mean in music?

What is this word supposed to be?

How to pronounce 'c++' in Spanish

How long after the last departure shall the airport stay open for an emergency return?

What is the unit of time_lock_delta in LND?

My bank got bought out, am I now going to have to start filing tax returns in a different state?

How do I check if a string is entirely made of the same substring?

All ASCII characters with a given bit count

Apply a different color ramp to subset of categorized symbols in QGIS?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

Why do real positive eigenvalues result in an unstable system? What about eigenvalues between 0 and 1? or 1?

Nails holding drywall

Is there a better way to say "see someone's dreams"?

Work requires me to come in early to start computer but wont let me clock in to get paid for it

A strange hotel

Negative Resistance

Could moose/elk survive in the Amazon forest?



Change Notification's action icon dynamically


Change icons in ActionBar dynamicallyGoogle Play app description formattingNavigation Drawer (Google+ vs. YouTube)How change action icons dynamically in android wearAction Bar icon not showing in android action barAndroid: update specific notification from multiple notifications which have remoteviewAndroid notification action icon: Resources not found exceptionchange notification addAction icon and text color without using custom layoutsNot able to change the icon in recyclerview androidSwitch Pause and Continue actions in NotificationCompat action






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm trying to create a notification for my app that has an action that I can change its icon, title and intent when I click on it.



I see its possible here at 3:33



https://www.youtube.com/watch?v=tKoQatxG0_8&index=73&list=PLOU2XLYxmsIIwGK7v7jg3gQvIAWJzdat_



But I couldn't find a way to do it.



also, If someone know how to use the pause/play icon on the Right watch in the link, i'll like to know that also.



Thanks from advance.










share|improve this question






















  • Hi frnd, DId you get any thread??

    – ranjith
    Jul 28 '14 at 12:24











  • @user1672337 No, the only solution for now is to recreate the notification every time you want to change the icon. If you have any answer, please write it.

    – user3184899
    Jul 28 '14 at 16:38












  • @user1672337 In the case of the little pause/play icon, you can place your own icon using setContentIcon(int) inside the extender.

    – user3184899
    Jul 28 '14 at 16:40

















1















I'm trying to create a notification for my app that has an action that I can change its icon, title and intent when I click on it.



I see its possible here at 3:33



https://www.youtube.com/watch?v=tKoQatxG0_8&index=73&list=PLOU2XLYxmsIIwGK7v7jg3gQvIAWJzdat_



But I couldn't find a way to do it.



also, If someone know how to use the pause/play icon on the Right watch in the link, i'll like to know that also.



Thanks from advance.










share|improve this question






















  • Hi frnd, DId you get any thread??

    – ranjith
    Jul 28 '14 at 12:24











  • @user1672337 No, the only solution for now is to recreate the notification every time you want to change the icon. If you have any answer, please write it.

    – user3184899
    Jul 28 '14 at 16:38












  • @user1672337 In the case of the little pause/play icon, you can place your own icon using setContentIcon(int) inside the extender.

    – user3184899
    Jul 28 '14 at 16:40













1












1








1








I'm trying to create a notification for my app that has an action that I can change its icon, title and intent when I click on it.



I see its possible here at 3:33



https://www.youtube.com/watch?v=tKoQatxG0_8&index=73&list=PLOU2XLYxmsIIwGK7v7jg3gQvIAWJzdat_



But I couldn't find a way to do it.



also, If someone know how to use the pause/play icon on the Right watch in the link, i'll like to know that also.



Thanks from advance.










share|improve this question














I'm trying to create a notification for my app that has an action that I can change its icon, title and intent when I click on it.



I see its possible here at 3:33



https://www.youtube.com/watch?v=tKoQatxG0_8&index=73&list=PLOU2XLYxmsIIwGK7v7jg3gQvIAWJzdat_



But I couldn't find a way to do it.



also, If someone know how to use the pause/play icon on the Right watch in the link, i'll like to know that also.



Thanks from advance.







android






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 28 '14 at 9:49









user3184899user3184899

1,32762235




1,32762235












  • Hi frnd, DId you get any thread??

    – ranjith
    Jul 28 '14 at 12:24











  • @user1672337 No, the only solution for now is to recreate the notification every time you want to change the icon. If you have any answer, please write it.

    – user3184899
    Jul 28 '14 at 16:38












  • @user1672337 In the case of the little pause/play icon, you can place your own icon using setContentIcon(int) inside the extender.

    – user3184899
    Jul 28 '14 at 16:40

















  • Hi frnd, DId you get any thread??

    – ranjith
    Jul 28 '14 at 12:24











  • @user1672337 No, the only solution for now is to recreate the notification every time you want to change the icon. If you have any answer, please write it.

    – user3184899
    Jul 28 '14 at 16:38












  • @user1672337 In the case of the little pause/play icon, you can place your own icon using setContentIcon(int) inside the extender.

    – user3184899
    Jul 28 '14 at 16:40
















Hi frnd, DId you get any thread??

– ranjith
Jul 28 '14 at 12:24





Hi frnd, DId you get any thread??

– ranjith
Jul 28 '14 at 12:24













@user1672337 No, the only solution for now is to recreate the notification every time you want to change the icon. If you have any answer, please write it.

– user3184899
Jul 28 '14 at 16:38






@user1672337 No, the only solution for now is to recreate the notification every time you want to change the icon. If you have any answer, please write it.

– user3184899
Jul 28 '14 at 16:38














@user1672337 In the case of the little pause/play icon, you can place your own icon using setContentIcon(int) inside the extender.

– user3184899
Jul 28 '14 at 16:40





@user1672337 In the case of the little pause/play icon, you can place your own icon using setContentIcon(int) inside the extender.

– user3184899
Jul 28 '14 at 16:40












2 Answers
2






active

oldest

votes


















1














You can access notification actions from notificationObj.actions



Try below: (Note: below code is not complete, but it will give you an idea on how to change action icon)



Notification status = null;
private NotificationCompat.Builder mBuilder;
private NotificationManager mManager;
private final int STATUS_ID = 1;
private String CHANNEL_ID = "channel_name";

private void setUpNotification()
mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

int playOrPause;
if(isPlaying())
playOrPause = R.drawable.ic_pause;
else
playOrPause = R.drawable.ic_play;


if(mBuilder == null)
//Setup Builder
mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID);
mBuilder.setOngoing(true)
.addAction(playOrPause, "play", pendingIntent1) // Index 0
.addAction(R.drawable.ic_2, "text2", pendingIntent2) // Index 1
.addAction(R.drawable.ic_3, "text3", pendingIntent3);// Index 2

status = mBuilder.build();
else
//Update builder as per your needs

mBuilder.setContentTitle(title);
status = mBuilder.build();
status.actions[0] = new Notification.Action(playOrPause, "play", pendingIntent1);



startForeground(STATUS_ID, status);







share|improve this answer






























    0














    I was able to solve the same problem by accessing builder.mActions. It's an ArrayList of all the actions you've added. I modify this without recreating the builder and calling build seems to update this.



    This doesn't seem to be documented in the SDK but I'm ok with that for now.



    Will let you know if I come up with something else






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24465587%2fchange-notifications-action-icon-dynamically%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      You can access notification actions from notificationObj.actions



      Try below: (Note: below code is not complete, but it will give you an idea on how to change action icon)



      Notification status = null;
      private NotificationCompat.Builder mBuilder;
      private NotificationManager mManager;
      private final int STATUS_ID = 1;
      private String CHANNEL_ID = "channel_name";

      private void setUpNotification()
      mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

      int playOrPause;
      if(isPlaying())
      playOrPause = R.drawable.ic_pause;
      else
      playOrPause = R.drawable.ic_play;


      if(mBuilder == null)
      //Setup Builder
      mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID);
      mBuilder.setOngoing(true)
      .addAction(playOrPause, "play", pendingIntent1) // Index 0
      .addAction(R.drawable.ic_2, "text2", pendingIntent2) // Index 1
      .addAction(R.drawable.ic_3, "text3", pendingIntent3);// Index 2

      status = mBuilder.build();
      else
      //Update builder as per your needs

      mBuilder.setContentTitle(title);
      status = mBuilder.build();
      status.actions[0] = new Notification.Action(playOrPause, "play", pendingIntent1);



      startForeground(STATUS_ID, status);







      share|improve this answer



























        1














        You can access notification actions from notificationObj.actions



        Try below: (Note: below code is not complete, but it will give you an idea on how to change action icon)



        Notification status = null;
        private NotificationCompat.Builder mBuilder;
        private NotificationManager mManager;
        private final int STATUS_ID = 1;
        private String CHANNEL_ID = "channel_name";

        private void setUpNotification()
        mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

        int playOrPause;
        if(isPlaying())
        playOrPause = R.drawable.ic_pause;
        else
        playOrPause = R.drawable.ic_play;


        if(mBuilder == null)
        //Setup Builder
        mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID);
        mBuilder.setOngoing(true)
        .addAction(playOrPause, "play", pendingIntent1) // Index 0
        .addAction(R.drawable.ic_2, "text2", pendingIntent2) // Index 1
        .addAction(R.drawable.ic_3, "text3", pendingIntent3);// Index 2

        status = mBuilder.build();
        else
        //Update builder as per your needs

        mBuilder.setContentTitle(title);
        status = mBuilder.build();
        status.actions[0] = new Notification.Action(playOrPause, "play", pendingIntent1);



        startForeground(STATUS_ID, status);







        share|improve this answer

























          1












          1








          1







          You can access notification actions from notificationObj.actions



          Try below: (Note: below code is not complete, but it will give you an idea on how to change action icon)



          Notification status = null;
          private NotificationCompat.Builder mBuilder;
          private NotificationManager mManager;
          private final int STATUS_ID = 1;
          private String CHANNEL_ID = "channel_name";

          private void setUpNotification()
          mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

          int playOrPause;
          if(isPlaying())
          playOrPause = R.drawable.ic_pause;
          else
          playOrPause = R.drawable.ic_play;


          if(mBuilder == null)
          //Setup Builder
          mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID);
          mBuilder.setOngoing(true)
          .addAction(playOrPause, "play", pendingIntent1) // Index 0
          .addAction(R.drawable.ic_2, "text2", pendingIntent2) // Index 1
          .addAction(R.drawable.ic_3, "text3", pendingIntent3);// Index 2

          status = mBuilder.build();
          else
          //Update builder as per your needs

          mBuilder.setContentTitle(title);
          status = mBuilder.build();
          status.actions[0] = new Notification.Action(playOrPause, "play", pendingIntent1);



          startForeground(STATUS_ID, status);







          share|improve this answer













          You can access notification actions from notificationObj.actions



          Try below: (Note: below code is not complete, but it will give you an idea on how to change action icon)



          Notification status = null;
          private NotificationCompat.Builder mBuilder;
          private NotificationManager mManager;
          private final int STATUS_ID = 1;
          private String CHANNEL_ID = "channel_name";

          private void setUpNotification()
          mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

          int playOrPause;
          if(isPlaying())
          playOrPause = R.drawable.ic_pause;
          else
          playOrPause = R.drawable.ic_play;


          if(mBuilder == null)
          //Setup Builder
          mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID);
          mBuilder.setOngoing(true)
          .addAction(playOrPause, "play", pendingIntent1) // Index 0
          .addAction(R.drawable.ic_2, "text2", pendingIntent2) // Index 1
          .addAction(R.drawable.ic_3, "text3", pendingIntent3);// Index 2

          status = mBuilder.build();
          else
          //Update builder as per your needs

          mBuilder.setContentTitle(title);
          status = mBuilder.build();
          status.actions[0] = new Notification.Action(playOrPause, "play", pendingIntent1);



          startForeground(STATUS_ID, status);








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 9 at 7:32









          E Player PlusE Player Plus

          1,4031319




          1,4031319























              0














              I was able to solve the same problem by accessing builder.mActions. It's an ArrayList of all the actions you've added. I modify this without recreating the builder and calling build seems to update this.



              This doesn't seem to be documented in the SDK but I'm ok with that for now.



              Will let you know if I come up with something else






              share|improve this answer



























                0














                I was able to solve the same problem by accessing builder.mActions. It's an ArrayList of all the actions you've added. I modify this without recreating the builder and calling build seems to update this.



                This doesn't seem to be documented in the SDK but I'm ok with that for now.



                Will let you know if I come up with something else






                share|improve this answer

























                  0












                  0








                  0







                  I was able to solve the same problem by accessing builder.mActions. It's an ArrayList of all the actions you've added. I modify this without recreating the builder and calling build seems to update this.



                  This doesn't seem to be documented in the SDK but I'm ok with that for now.



                  Will let you know if I come up with something else






                  share|improve this answer













                  I was able to solve the same problem by accessing builder.mActions. It's an ArrayList of all the actions you've added. I modify this without recreating the builder and calling build seems to update this.



                  This doesn't seem to be documented in the SDK but I'm ok with that for now.



                  Will let you know if I come up with something else







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 13 '17 at 0:51









                  Sameer JSameer J

                  16029




                  16029



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24465587%2fchange-notifications-action-icon-dynamically%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                      Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                      Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved