Wish Hotswap code with widget

Discussion in 'Bugs & wishlist' started by Multiverse app, Jul 21, 2018.

  1. Multiverse app

    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!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Change the code to:
    Code:
    #If Release
    rv = ConfigureHomeWidget(...)
    #end if
     
  3. Multiverse app

    Multiverse app Active Member Licensed User

    aldready tried, throws this error in Debug mode-

    Code:
    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').
     
  4. Multiverse app

    Multiverse app Active Member Licensed User

    Still facing the same issue, can't find solution anywhere
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    What do you have in your manifest editor?

    Exclude anything related to the widget with:
    Code:
    #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
     
  6. Multiverse app

    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.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Remove the file and add it with CreateResource as I did in the previous post.
     
    Multiverse app likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice