Hi
I want change an image for widget in event, how can i do?
Thanks
change image widget
Moderator: Martin
Re: change image widget
Is a limitation change an image to widget?
Re: change image widget
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
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
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.
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
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.
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.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: change image widget
Thanks for verifying Desmanto!
I deleted and readded the widget to my homescreen and now it's working as expected. Yeah!
I deleted and readded the widget to my homescreen and now it's working as expected. Yeah!