How to get an image into a widget

Post your questions and help other users.

Moderator: Martin

Post Reply
Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

How to get an image into a widget

Post by Wibbly » 31 Jan 2021 15:33

Still using and tweaking my flows :-) Long live AM!
I have an icon that appears in a notification (Spotify album cover) and I want it to display in a widget. It doesn't seem I can pass it into a widget as a global variable as global variables can't contain images, right?

So is my only option to write the image to a file, and refer to the file in the widget? In an ideal world I'd rather keep it all in memory and not keep writing and overwriting the file - is this possible (to avoid file writing by keeping it in memory)?

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: How to get an image into a widget

Post by digitalstone » 05 Apr 2021 13:22

I have a weather widget, in where i'm using an icon.
That icon is one of many inside a folder on my phone.
I simply tell with the setWidgetElementProperty function what the filepath of that icon should be.
refreshWidget if necessary.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Post Reply