Converting from an Activity based project to B4XPages and sofare so good.
Have a problem though implementing my custom keyboard, which works perfectly fine in the old project.
The error I get is this:
Error occurred on line: 9754 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1057)
at b4a.exampleljjll.b4xmainpage$ResumableSub_SetPage.resume(b4xmainpage.java:1453)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1772)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
... 24 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
... 25 more
Caused by: java.lang.RuntimeException: Method: disableSoftKeyboard not found in: b4a.exampleljjll.main
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
at b4a.exampleljjll.b4xmainpage._setedittextinput_type(b4xmainpage.java:20793)
at b4a.exampleljjll.page0._setfindpatientcustomkeyboard(page0.java:970)
at b4a.exampleljjll.page0._loadlayout(page0.java:220)
... 27 more
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
When running this code from B4XMainPage:
I call SetEditTextInput_Type from another page, after the layout has been loaded.
I also tried to run the same code from the page where the layout was loaded, but exactly same problem.
Any idea what the problem could be here?
RBS
Have a problem though implementing my custom keyboard, which works perfectly fine in the old project.
The error I get is this:
Error occurred on line: 9754 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1057)
at b4a.exampleljjll.b4xmainpage$ResumableSub_SetPage.resume(b4xmainpage.java:1453)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1772)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
... 24 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
... 25 more
Caused by: java.lang.RuntimeException: Method: disableSoftKeyboard not found in: b4a.exampleljjll.main
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
at b4a.exampleljjll.b4xmainpage._setedittextinput_type(b4xmainpage.java:20793)
at b4a.exampleljjll.page0._setfindpatientcustomkeyboard(page0.java:970)
at b4a.exampleljjll.page0._loadlayout(page0.java:220)
... 27 more
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
When running this code from B4XMainPage:
B4X:
Sub Class_Globals
Public NativeMe As JavaObject
'etc.
End Sub
#IF JAVA
import android.widget.EditText;
import android.os.Build;
import android.text.InputType;
public void disableSoftKeyboard(final EditText v) {
if (Build.VERSION.SDK_INT >= 11) {
v.setRawInputType(InputType.TYPE_CLASS_TEXT);
v.setTextIsSelectable(true);
v.setShowSoftInputOnFocus(false);
} else {
v.setRawInputType(InputType.TYPE_NULL);
v.setFocusable(true);
}
}
public void enableSoftKeyboard(final EditText v, int iKeyBoardType) {
if (Build.VERSION.SDK_INT >= 11) {
v.setRawInputType(iKeyBoardType);
v.setTextIsSelectable(true);
v.setShowSoftInputOnFocus(true);
} else {
v.setRawInputType(iKeyBoardType);
v.setFocusable(true);
}
}
#END IF
Sub SetEditTextInput_Type(bDoCustomKeyboard As Boolean, oEditText As EditText, iKeyBoardType As Int, bHandleAction As Boolean)
If NativeMe.IsInitialized = False Then
NativeMe.InitializeContext
End If
Log("SetEditTextInput_Type, oEditText.Tag: " & oEditText.Tag) 'this shows fine, with the right Tag
If bDoCustomKeyboard Then
NativeMe.RunMethod("disableSoftKeyboard", Array As Object(oEditText)) '<<<<< java.lang.reflect.InvocationTargetException
Else
'etc. code not relevant to the mentioned problem
End Sub
I call SetEditTextInput_Type from another page, after the layout has been loaded.
I also tried to run the same code from the page where the layout was loaded, but exactly same problem.
Any idea what the problem could be here?
RBS