Android Question [Solved] XUIViews error

Ivan Aldaz

Member
Licensed User
Longtime User
Hi

I get the same error as in the thread https://www.b4x.com/android/forum/t...-works-fine-library-unchecked.109904/#content:

---------
B4A Version: 10.2
Java Version: 11
Parsing code. (0.24s)
Building folders structure. (0.18s)
Running custom action. (0.15s)
Compiling code. (0.63s)
Compiling layouts code. (0.02s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling debugger engine code. Error
B4A line: 208
If Code = xui.DialogResponse_Cancel Then xbtn.Req
shell\src\com\heindeweisoft\madpairs\b4xdialog_subs_0.java:389: error: method solveBoolean in class RemoteObject cannot be applied to given types;
if (RemoteObject.solveBoolean("=",b4xdialog._code,BA.numberCast(double.class, __ref.getField(false,"_xui" /*RemoteObject*/ ).getField(true,"DialogResponse_Cancel")))) {
^
required: String,RemoteObject[]
found: String,code,RemoteObject
reason: varargs mismatch; code cannot be converted to RemoteObject
1 error
-------

After decompressing XUIViews library (v2.42) and some research, found that the issue is in line #208 in the B4XDialog class:
B4X:
Sub CreateButton (Text As Object, Code As Int)
    If Text = "" Then Return
    #if B4J
    Dim btn As Button
    #else
    Dim btn As Label
    #End If
    btn.Initialize("Button")   
    Dim xbtn As B4XView = btn
    XUIViewsUtils.SetTextOrCSBuilderToLabel(xbtn, Text)
    xbtn.Tag = Code
    xbtn.SetColorAndBorder(ButtonsColor, 0dip, BorderColor, 5dip)
    xbtn.SetTextAlignment("CENTER", "CENTER")
    xbtn.TextColor = ButtonsTextColor
    xbtn.Font = ButtonsFont
    Dim numberOfButtons As Int = Base.NumberOfViews 'nothing was added yet except of buttons
    Base.AddView(xbtn, Base.Width - 4dip - numberOfButtons * (ButtonWidth + 5dip) - ButtonWidth, _
         Base.Height - ButtonsHeight - 4dip, ButtonWidth, ButtonsHeight)
    If Code = xui.DialogResponse_Cancel Then xbtn.RequestFocus   '<<<<---This is line #208
End Sub

Commenting this line and creating again the B4X library, don't get the error, and just lose the requested focus on this button. But the question is why in a new project with only this library and the original manifest file the error doesn't appear...

Thank you
 
Last edited:

Ivan Aldaz

Member
Licensed User
Longtime User
Sorry, my fault. Mistery solved.
I had a code module in my project named 'Code', the same name as the variable in your library.
Thank you
 
Upvote 0
Top