LucaMs Expert Licensed User Longtime User Sep 27, 2020 #1 Using the class InlineEditing for B4XTable in B4A I get this error: Error occurred on line: 61 (InlineEditing) java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference Spoiler: Full error msg Error occurred on line: 61 (InlineEditing) java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference at b4a.example.inlineediting$ResumableSub_SetEditableControlLayout.resume(inlineediting.java:352) 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:348) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.BA.raiseEvent(BA.java:193) at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43) at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1704) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:101) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7523) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) but only in B4A, the B4J version (it is a B4XPages project) everything works fine. Setting a breakpoint before and then continuing execution by pressing F5, the exception is not raised; for this reason I tried to insert a Sleep (100) but without success. P.S. Same B4XMainPage, of course, in B4A and B4J and all views declared as B4XView (except the B4XTable) Last edited: Sep 27, 2020
Using the class InlineEditing for B4XTable in B4A I get this error: Error occurred on line: 61 (InlineEditing) java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference Spoiler: Full error msg Error occurred on line: 61 (InlineEditing) java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference at b4a.example.inlineediting$ResumableSub_SetEditableControlLayout.resume(inlineediting.java:352) 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:348) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.BA.raiseEvent(BA.java:193) at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43) at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1704) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:101) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7523) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) but only in B4A, the B4J version (it is a B4XPages project) everything works fine. Setting a breakpoint before and then continuing execution by pressing F5, the exception is not raised; for this reason I tried to insert a Sleep (100) but without success. P.S. Same B4XMainPage, of course, in B4A and B4J and all views declared as B4XView (except the B4XTable)
Erel B4X founder Staff member Licensed User Longtime User Sep 29, 2020 #2 Please upload a small example... Upvote 0
LucaMs Expert Licensed User Longtime User Sep 29, 2020 #3 Erel said: Please upload a small example... Click to expand... It is small but... uses a local MySql DB. I hope you can test it simulating the fetching data. Anyway I'm attaching both the DB and the PHP script. It is a test (rather crude) to help someone to use MySql + PHP in a B4XPages (B4A & B4J) project. If anyone cares, it's based on this @KMatle's tutorial. Attachments MySQL_PHP_Example.zip MySQL_PHP_Example.zip 17.7 KB · Views: 592 PHPandMySqlDB.zip PHPandMySqlDB.zip 1.8 KB · Views: 639 Upvote 0
Erel said: Please upload a small example... Click to expand... It is small but... uses a local MySql DB. I hope you can test it simulating the fetching data. Anyway I'm attaching both the DB and the PHP script. It is a test (rather crude) to help someone to use MySql + PHP in a B4XPages (B4A & B4J) project. If anyone cares, it's based on this @KMatle's tutorial.
LucaMs Expert Licensed User Longtime User Oct 1, 2020 #4 I'm attaching a more simple test B4XPages project. This one does not use MySql nor PHP but a Map of "records" created at runtime (this was not the purpose of the project but serves to be able to try to find the bug). Like the other, B4J does not give problems, B4A throws the exception in the InlineEditing class (see post #1). Attachments B4XTableInlineEditingTest.zip B4XTableInlineEditingTest.zip 21.7 KB · Views: 729 Last edited: Oct 1, 2020 Upvote 0
I'm attaching a more simple test B4XPages project. This one does not use MySql nor PHP but a Map of "records" created at runtime (this was not the purpose of the project but serves to be able to try to find the bug). Like the other, B4J does not give problems, B4A throws the exception in the InlineEditing class (see post #1).
Erel B4X founder Staff member Licensed User Longtime User Oct 1, 2020 #5 You need to change line 64 to: Code: Copy If "TextFlow" = p.GetView(p.NumberOfViews - 1).Tag Then I think that it wasn't supposed to be a B4X library. It was implemented in B4J in mind. Handling the keyboard might be quite difficult. Upvote 0
You need to change line 64 to: Code: Copy If "TextFlow" = p.GetView(p.NumberOfViews - 1).Tag Then I think that it wasn't supposed to be a B4X library. It was implemented in B4J in mind. Handling the keyboard might be quite difficult.
LucaMs Expert Licensed User Longtime User Oct 1, 2020 #6 Erel said: If "TextFlow" = p.GetView(p.NumberOfViews - 1).Tag Then Click to expand... This will never enter my head, also because there is no more space ? Perhaps also because I have not read very well the thread in which it was discussed. Upvote 0
Erel said: If "TextFlow" = p.GetView(p.NumberOfViews - 1).Tag Then Click to expand... This will never enter my head, also because there is no more space ? Perhaps also because I have not read very well the thread in which it was discussed.
LucaMs Expert Licensed User Longtime User Oct 1, 2020 #7 Erel said: New warning: "Comparison of Object to other types will fail if exact types do not match. Better to put the object on the right side of the comparison. (warning #35)" Click to expand... As you have seen, strangely there was no warning. Upvote 0
Erel said: New warning: "Comparison of Object to other types will fail if exact types do not match. Better to put the object on the right side of the comparison. (warning #35)" Click to expand... As you have seen, strangely there was no warning.
LucaMs Expert Licensed User Longtime User Oct 1, 2020 #8 LucaMs said: This will never enter my head, also because there is no more space ? Perhaps also because I have not read very well the thread in which it was discussed. Click to expand... This is the reason (it helps to remember): [Erel wrote] B4X: Copy If 1 = m.Get("x") Then 'no warning here Now the compiler will know that it is a numeric comparison and it will be safer. Upvote 0
LucaMs said: This will never enter my head, also because there is no more space ? Perhaps also because I have not read very well the thread in which it was discussed. Click to expand... This is the reason (it helps to remember): [Erel wrote] B4X: Copy If 1 = m.Get("x") Then 'no warning here Now the compiler will know that it is a numeric comparison and it will be safer.
M Mahares Expert Licensed User Longtime User Oct 1, 2020 #9 LucaMs said: This will never enter my head Click to expand... I tried your sample. Why did you declare this thread 'Solved'. Try to edit a cell, then click to edit another cell, the first change does not persist and the table locks up. Upvote 0
LucaMs said: This will never enter my head Click to expand... I tried your sample. Why did you declare this thread 'Solved'. Try to edit a cell, then click to edit another cell, the first change does not persist and the table locks up.
LucaMs Expert Licensed User Longtime User Oct 1, 2020 #10 Mahares said: Why did you declare this thread 'Solved'. Click to expand... Because the bug was solved. The B4A version crashed as soon as you touched a cell. Upvote 0
Mahares said: Why did you declare this thread 'Solved'. Click to expand... Because the bug was solved. The B4A version crashed as soon as you touched a cell.
M Mahares Expert Licensed User Longtime User Oct 1, 2020 #11 LucaMs said: Because the bug was solved. The B4A version crashed as soon as you touched a cell. Click to expand... Yes, I know the purpose is to identify the crash, but the example code you posted does not work even after making the correction to the class module that Erel pointed out to you. Try to test it for yourself.. Upvote 0
LucaMs said: Because the bug was solved. The B4A version crashed as soon as you touched a cell. Click to expand... Yes, I know the purpose is to identify the crash, but the example code you posted does not work even after making the correction to the class module that Erel pointed out to you. Try to test it for yourself..
LucaMs Expert Licensed User Longtime User Oct 1, 2020 #12 Mahares said: Yes, I know the purpose is to identify the crash, but the example code you posted does not work even after making the correction to the class module that Erel pointed out to you. Try to test it for yourself.. Click to expand... Well, it was just a test. I could try to fix that bug but for the moment it's not worth. It would be necessary to somehow detect the "lost focus" (but if the cell does not contain an EditText this is difficult; indeed, it would be even if it were an EditText) and manage the software keyboard (B4A). Upvote 0
Mahares said: Yes, I know the purpose is to identify the crash, but the example code you posted does not work even after making the correction to the class module that Erel pointed out to you. Try to test it for yourself.. Click to expand... Well, it was just a test. I could try to fix that bug but for the moment it's not worth. It would be necessary to somehow detect the "lost focus" (but if the cell does not contain an EditText this is difficult; indeed, it would be even if it were an EditText) and manage the software keyboard (B4A).