Android Question Widget not working

Nickelgrass

Active Member
Licensed User
Longtime User
Hello,
its been some time since I made an app with widget. So I followed the tutorial from Erel that I used in a previous project several years ago. It all worked fine then.
Now I made a very simple app to test the widget. But it does not work as expected.
First I get an error stating that the layout file can not be found when the widget is created. But it is there. Strangely the widget is displayed in spite of it. Second I can not add a click event. The designer says something like "this module does not support view events". The app is running on API 30 in debug mode. Is there anything else I need to do? The example tutorial seems to have the same error. If I start the app in Release mode then the widget does not load properly in some cases but displays an error that the widget could not be loaded.

error message:
Copying updated assets files (3)
** Activity (main) Pause, UserClosed = true **
** Receiver (widget) OnReceive **
*** Service (widget) Create ***
Error occurred on line: 13 (widget)
java.io.FileNotFoundException: widgetstd.bal
    at android.content.res.AssetManager.nativeOpenAsset(Native Method)
    at android.content.res.AssetManager.open(AssetManager.java:824)
    at android.content.res.AssetManager.open(AssetManager.java:801)
    at anywheresoftware.b4a.objects.RemoteViewsWrapper.createRemoteViews(RemoteViewsWrapper.java:40)
    at b4a.example.widget._service_create(widget.java:176)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at b4a.example.widget.onCreate(widget.java:56)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3953)
    at android.app.ActivityThread.access$1500(ActivityThread.java:219)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1875)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
** Service (widget) Start **
Service started in foreground mode.
[IDE message - 4:17:40]
Current module does not support layout events.

Thanks
 

Attachments

  • widget.zip
    36.3 KB · Views: 65

Alessandro71

Well-Known Member
Licensed User
Longtime User
Probably yes. I cannot give a time frame. It is not a simple change and widgets are not used too often.
Today Play Store has started enforcing SDK 31 for my apps updates
Is the Widget fix included in the new B4A 12?
 
Upvote 0
Top