Android Question [Solved] B4XTable - InlineEditing class

LucaMs

Expert
Licensed User
Longtime User
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

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:

LucaMs

Expert
Licensed User
Longtime User
Please upload a small example...
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
    17.7 KB · Views: 317
  • PHPandMySqlDB.zip
    1.8 KB · Views: 322
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
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
    21.7 KB · Views: 413
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
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.
This is the reason (it helps to remember):

[Erel wrote]
B4X:
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

Mahares

Expert
Licensed User
Longtime User
Because the bug was solved. The B4A version crashed as soon as you touched a cell.
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

Expert
Licensed User
Longtime User
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..
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…