Page 1 of 1

change image widget

Posted: 30 Mar 2015 19:31
by Drago73
Hi
I want change an image for widget in event, how can i do?
Thanks

Re: change image widget

Posted: 31 Mar 2015 07:19
by Drago73
Is a limitation change an image to widget?

Re: change image widget

Posted: 01 Apr 2015 18:10
by Martin
Hi,

You can use action Script with function setWidgetElementProperty to change an image from a flow.
A function call could look like this: setWidgetElementProperty("Widget1", "Image Element 1", "path", "/storage/emulated/0/image.jpg");

"Widget1" is the name of the widget
"Image Element 1" is the name of the image element on the widget
"path" is the name of the property to change
the last argument is the path to the image to use

Please use the button Function to create the function call so Automagic offers a dialog to pick the widget name, element name and property to change using a dialog.
I highly recommend to give the widget and the widget element a good name before you write a script to modify the widget.

Regards,
Martin

Re: change image widget

Posted: 02 Apr 2015 16:11
by Drago73
Ok work fine!

Re: change image widget

Posted: 13 Aug 2017 01:49
by GollyJer
Hi. Sorry to dig up an old post... but is this still expected to work?
Does the launcher in use have an affect? I'm using Nova Launcher and am unable to update the widget icon.

The following does nothing.

Code: Select all

setWidgetElementProperty("Toggle Overlays", "Image_1", "path", "/storage/emulated/0/!ROM/4 - Tweaks/icons/off.png");
refreshWidget("Toggle Overlays",true);

Re: change image widget

Posted: 13 Aug 2017 04:45
by Desmanto
I am using nova as well. When you created the widget, there is a prompt, you should allow it. Try to readd you widget to home screen.

I tried exactly as your script and copy a png to that path. Create a kind of toggle switch between 2 images, and it works. The image changed. Tried to execute the script alone, image still changed.

I know it can be done, but this is still a cool idea. Haven't explore the power of widget so far.

Re: change image widget

Posted: 13 Aug 2017 15:04
by GollyJer
Thanks for verifying Desmanto!
I deleted and readded the widget to my homescreen and now it's working as expected. Yeah! :!: