Pierre Hébert could you check if there is a problem with setDefaultIcon and/or createImage?

Pierre Hébert could you check if there is a problem with setDefaultIcon and/or createImage? This line worked before (I think until last beta, but I’m not sure)

play.setDefaultIcon(Image.createImage(MY_PKG, “ic_play”));

(context is the multitool music widget setup)

]]>

14 Commentsto Pierre Hébert could you check if there is a problem with setDefaultIcon and/or createImage?

  1. Anonymous says:

    < ![CDATA[

    The following script works for me with the beta build:


    var i = getEvent().getContainer().addShortcut(“a”,new Intent(),0,0);


    i.setDefaultIcon(Image.createImage(getActiveScreen().getContext().getPackageName(),”icon”));


    It is very similar, I tried with getEvent().getItem() too (I mean with an already existing item, not a newly created one)


    But I brought some modifications to the Image.createImage(pkg, name) method recently, in order to improve support for 9 patch. Maybe there’s a border effect here, I can’t see what at the moment, maybe a security exception due to the fact the package is not the same. Which android version do you use?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Seems to work with external packages too

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Could you check if createImage returns null or a correct image please ?

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Pierre Hébert it returns a bitmap image.

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Is ic_play a bitmap that can be saved to file (possibly using saveToFile)?


    By the way I tried with the music widget recently and icons were ok

    ]]>

  6. Anonymous says:

    < ![CDATA[

    ic_play is a png resource. How would I save an Image to a file?

    ]]>

  7. Anonymous says:

    < ![CDATA[

    using ImageBitmap.saveToFile() but I see no reason why it would fail using a png. This could have been the case for a vector drawable.


    If so, does setDefaultIcon() works if you use a blank image created with createImage(int width, int height) ? If doesn’t replace the robot icon then setDefaultIcon would be in cause

    ]]>

  8. Anonymous says:

    < ![CDATA[

    OK, the image is definetly created correctly, as I can save it to a file, even from the setup script.


    I am on Android 6.


    It is really weird. I can set this icon with a script on any item but the one which the setup script created that should have this icon. Even other items created by the same script accept the icon. Just the item which should already have this default icon doesn’t work. (This is the same for all 3 icons)

    ]]>

  9. Anonymous says:

    < ![CDATA[

    The behaviour just changed again after I rerun the setup. Now I cannot set the icon on any items created by the setup, but still on other items. I am lost.

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Pierre Hébert do you have a github account so I can open the sources for you?

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Yes, since a few minutes: https://github.com/pierrehebert/

    ]]>

  12. Anonymous says:

    < ![CDATA[

    Pierre Hébert


    https://github.com/F43nd1r/Multitool/invitations


    The setup script is in the raw folder called music_setup.js, but if you need more context feel free to look around.

    ]]>

  13. Anonymous says:

    < ![CDATA[

    Thanks, I’ll look at this

    ]]>

  14. Anonymous says:

    < ![CDATA[

    I found the bug (in setDefaultIcon, fails to save the icon because the icon directory wasn’t created). Interestingly this is a very old one, I wonder how it managed to survive.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *