hi
i'm using this code to change text:
but i get this error , on the line ( buttons.Set(i, newButton) ) :
what am i doing wrong?
i'm using this code to change text:
B4X:
Sub ReplaceBarButtonText(Tag As String, NewText As String)
Dim buttons As List = page0.TopRightButtons
For i = 0 To buttons.Size - 1
Dim bb As BarButton = buttons.Get(i)
If bb.Tag = Tag Then
Dim newButton As BarButton
newButton.InitializeText(NewText, Tag)
buttons.Set(i, newButton)
Exit
End If
Next
Page0.TopLeftButtons = buttons
End Sub
but i get this error , on the line ( buttons.Set(i, newButton) ) :
Application_Start
Error occurred on line: 1025 (main)
-[__NSArrayI setObject:atIndexedSubscript:]: unrecognized selector sent to instance 0x15557a60
Stack Trace: (
CoreFoundation <redacted> + 154
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 202
CoreFoundation <redacted> + 706
CoreFoundation _CF_forwarding_prep_0 + 24
ADHD -[B4IList Set::] + 192
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 282
ADHD +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928
ADHD -[B4IShell runVoidMethod] + 210
ADHD -[B4IShell raiseEventImpl:method:args::] + 2002
ADHD -[B4IShellBI raiseEvent:eventarams:] + 1316
ADHD __33-[B4I raiseUIEvent:eventarams:]_block_invoke + 74
libdispatch.dylib <redacted> + 10
libdispatch.dylib <redacted> + 22
libdispatch.dylib <redacted> + 278
CoreFoundation <redacted> + 8
CoreFoundation <redacted> + 1300
CoreFoundation CFRunLoopRunSpecific + 522
CoreFoundation CFRunLoopRunInMode + 106
GraphicsServices GSEventRunModal + 138
UIKit UIApplicationMain + 1136
ADHD main + 116
libdyld.dylib <redacted> + 2
)
what am i doing wrong?