D denik Member Licensed User Longtime User May 9, 2017 #1 I need change hint programmatically in class NumPad [customview] - Numpad For this purpose, sub was added to the class Code: 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 Code: 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 real devices, Android 4.4 & 7.0, b4A ver 6.80 Last edited: May 9, 2017
I need change hint programmatically in class NumPad [customview] - Numpad For this purpose, sub was added to the class Code: 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 Code: 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 real devices, Android 4.4 & 7.0, b4A ver 6.80
R ronell Well-Known Member Licensed User Longtime User May 10, 2017 #2 could you upload your project, export as zip Upvote 0
stevel05 Expert Licensed User Longtime User May 10, 2017 #3 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. Upvote 0
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.
Erel B4X founder Staff member Licensed User Longtime User May 10, 2017 #4 stevel05 said: 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. Click to expand... 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. Upvote 0
stevel05 said: 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. Click to expand... 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.
D denik Member Licensed User Longtime User May 10, 2017 #5 I can't rename Sub setHint (eg insert underscore), because I have no access to it. With CallSubDelayed2(Me, "setHint", s) and CallSubDelayed2(Me, "SetHint", s) I have the same error Upvote 0
I can't rename Sub setHint (eg insert underscore), because I have no access to it. With CallSubDelayed2(Me, "setHint", s) and CallSubDelayed2(Me, "SetHint", s) I have the same error
DonManfred Expert Licensed User Longtime User May 10, 2017 #6 denik said: CallSubDelayed2(Me, "setHint", s) and CallSubDelayed2(Me, "SetHint", s) I have the same error Click to expand... you need to use the underscore here too.... Upvote 0
denik said: CallSubDelayed2(Me, "setHint", s) and CallSubDelayed2(Me, "SetHint", s) I have the same error Click to expand... you need to use the underscore here too....
Erel B4X founder Staff member Licensed User Longtime User May 10, 2017 #7 denik said: I can't rename Sub setHint (eg insert underscore), because I have no access to it. Click to expand... Why? All the code is in the class. Upvote 0
denik said: I can't rename Sub setHint (eg insert underscore), because I have no access to it. Click to expand... Why? All the code is in the class.