Beta 1.6: Creating multiple homescreen widgets

corwin42

Expert
Licensed User
Longtime User
Hi Erel,

If I create two or more instances of a widget on the homescreen is it possible to differentiate between them? Currently if I press the ImageView of the example Project all widget instances are updated.

Is it possible to create more than one widget layout? If I try to call ConfigureHomeWidget() from the same service twice B4A tells me that it is only allowed once per service module. If I create a second service module for a second widget (with another layout) I get the following error:

Compiling code. 0.05
Generating R file. Error
AndroidManifest.xml:27: error: Error: No resource found that matches the given name (at 'resource' with value '@xml/widgetservice_info').

Would be nice if this is possible so we can create different widget layouts for our apps.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
For now you cannot differentiate between multiple instances of the same widget.
This feature can be implemented with a help of a small library. I preferred to keep the main interface simpler as this feature is not needed in most cases.

You can have several types of widgets in the same application.
Each widget type should have its own service.
If it doesn't work for you, please upload your project.
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
For now you cannot differentiate between multiple instances of the same widget.
This feature can be implemented with a help of a small library. I preferred to keep the main interface simpler as this feature is not needed in most cases.
This is OK for me.

You can have several types of widgets in the same application.
Each widget type should have its own service.
If it doesn't work for you, please upload your project.

I just doubled the service from the example, created a slightly different (smaller layout) and tried to rename all process_global variables but still get the error.
 

Attachments

  • TwoWidgets.zip
    14.8 KB · Views: 269
Upvote 0

Inman

Well-Known Member
Licensed User
Longtime User
So once you fix the bug, it will be possible for an app to have multiple widgets of may be different sizes like 4x4, 1x3 etc..?
 
Upvote 0

touchsquid

Active Member
Licensed User
Longtime User
I have created a couple of widgets which work, but I often get the message "no More room on this homescreen" when configuring, and the widgets cannot be moved, they always stay where the main panel upper left and top settings are.
 
Upvote 0

csgoh

Member
Licensed User
Longtime User
Same widget two instances

Hi. is it possible to have two similar widgets on the same screen?

What I want to achieve is that each widget instance on the screen has same layout but different contents.

Currently I placed two similar widgets on screen, but when I click a button on one widget, the other widget button is also clicked. This is not what I want. I want each of the widget respond to their own event.

Is this possible?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…