I need change hint programmatically in class NumPad [customview] - Numpad
For this purpose, sub was added to the class
B4X:
Public Sub setHint(s As String)
If flEditText1.IsInitialized = False Then
CallSubDelayed2(Me, "setHint", s)
Return
End If
flEditText1.Hint = s
End Sub
Numpad2.Hint = "MyHint" - the only addition in example from Erel work in Debug and Release but in Release (obfuscated) error
B4X:
java.lang.Exception: Sub sethint was not found.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:185)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6272)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
--------- beginning of crash
If you are calling any sub using CallSub or CallSubDelayed or any thing else that uses a string name, the SubName should include an underscore if you are going to use Obsfuscation. The underscore stops the sub name being obsfuscated so that it can be found.
If you change the name to something like set_Hint, then is should work.
Although I'm not quite sure of the logic of the sub, I'll assume it is an example.
If you are calling any sub using CallSub or CallSubDelayed or any thing else that uses a string name, the SubName should include an underscore if you are going to use Obsfuscation.
Note that in most cases it should work without an underscore. The compiler does try to find CallSub usages. Maybe it fails here because it is a property.
An underscore is the best solution. As a test you can try it with SetHint instead of setHint.