Wish Hotswap code with widget

Multiverse app

Active Member
Licensed User
This has been bothering me for some time now. So almost all of my projects have widgets in them, and there is a very annoying thing that happens when I try to hot-swap the code (ctr+s) (when widgets are added to the home screen)-

upload_2018-7-21_19-8-49.png


The compiler again tries to create the xml file of the widget again, and so this error occurs. Now I have to recompile the whole project even for small changes, which takes more than 3-4 minutes if I'm working on a big project. Makes working very frustrating.

Would love a workaround for this in the next update of B4A.
Thank you!
 

Multiverse app

Active Member
Licensed User
Change the code to:
B4X:
#If Release
rv = ConfigureHomeWidget(...)
#end if
aldready tried, throws this error in Debug mode-

B4X:
B4A Version: 8.30
Parsing code.    (0.73s)
Compiling code.    (7.04s)
Compiling layouts code.    (0.75s)
Organizing libraries.    (18.29s)
Generating R file.    Error
res\xml\vr_widget_info.xml:2: error: Error: No resource found that matches the given name (at 'initialLayout' with value '@layout/vr_widget_layout').
 

Erel

Administrator
Staff member
Licensed User
What do you have in your manifest editor?

Exclude anything related to the widget with:
B4X:
#if Release
AddReceiverText(widgetservice, <intent-filter>
           <action android:name="android.appwidget.action.APPWIDGET_UPDATE_OPTIONS" />
           </intent-filter>)
CreateResource(xml, widgetservice_info.xml,
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
   android:minWidth="140dp"
   android:minHeight="120dp"
   android:initialLayout="@layout/widgetservice_layout"
   android:updatePeriodMillis="12334" />
)
#end if
 

Multiverse app

Active Member
Licensed User
Hi Erel,
I do not have any widget related code in the Manifest.
But, I edited "vr_widget_layout.xml" in \Objects\res\xml to avoid scaling issues, as described here.
 
Top