Android Question B4XTable Error

Guenter Becker

Active Member
Licensed User
Hello Experts,
due to I'm developing for the German people I like to know how to change the Hint "Search" in the search section of the table header. I know that there is another (old) thread and read it. There was an answer from Erel with a code snipped as followes:

bxtTable.SearchField.HintText = "Suchen" <--- in the original of Erels snipped ugly characters are shown I replaced them?
bxtTable.SearchField.Update

I use the snipped in the example project and tested it on the emulator. The line .. bxtTable.SearchField.Update.. crashes the app with the error info as followes:

MainForm.RootPane.LoadLayout("1")

** Activity (main) Create, isFirst = true **
b4xfloattextfield_update (java line: 642)
java.lang.NullPointerException: Attempt to read from field 'android.graphics.Typeface anywheresoftware.b4a.objects.B4XViewWrapper$B4XFont.typeface' on a null object reference
at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.CreateFont2(B4XViewWrapper.java:720)
at b4a.B4XPages_SQLiteLight2.b4xfloattextfield._update(b4xfloattextfield.java:642)
at b4a.B4XPages_SQLiteLight2.b4xmainpage._inittable(b4xmainpage.java:250)
at b4a.B4XPages_SQLiteLight2.b4xmainpage._b4xpage_created(b4xmainpage.java:146)
at b4a.B4XPages_SQLiteLight2.b4xmainpage.callSub(b4xmainpage.java:388)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1066)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1037)
at b4a.B4XPages_SQLiteLight2.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:498)
at b4a.B4XPages_SQLiteLight2.b4xpagesmanager._showpage(b4xpagesmanager.java:800)
at b4a.B4XPages_SQLiteLight2.b4xpagesmanager._addpage(b4xpagesmanager.java:198)
at b4a.B4XPages_SQLiteLight2.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:205)
at b4a.B4XPages_SQLiteLight2.b4xpagesmanager._initialize(b4xpagesmanager.java:681)
at b4a.B4XPages_SQLiteLight2.main._activity_create(main.java:354)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.B4XPages_SQLiteLight2.main.afterFirstLayout(main.java:105)
at b4a.B4XPages_SQLiteLight2.main.access$000(main.java:17)
at b4a.B4XPages_SQLiteLight2.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
java.lang.NullPointerException: Attempt to read from field 'android.graphics.Typeface anywheresoftware.b4a.objects.B4XViewWrapper$B4XFont.typeface' on a null object reference

.. if I ommit the code line it works but the "Search" Word is not updated.

Question: Whats going wrong, any Idea to solve the problem?

Best regards from Germany
keep well
Guenter
 

Mahares

Expert
Licensed User
Longtime User
Question: Whats going wrong, any Idea to solve the problem?
This works for me on a real device. I do not use an emulator and it is not recommended. Do not forget the sleep(0) line where it is supposed to be:
B4X:
Sleep(0) 'this is required to allow internal layout to be loaded.
    B4XTable1.SearchField.HintText = "Chercher"   'search en Français
    B4XTable1.SearchField.Update
 
Upvote 0

Guenter Becker

Active Member
Licensed User
This works for me on a real device. I do not use an emulator and it is not recommended. Do not forget the sleep(0) line where it is supposed to be:
B4X:
Sleep(0) 'this is required to allow internal layout to be loaded.
    B4XTable1.SearchField.HintText = "Chercher"   'search en Français
    B4XTable1.SearchField.Update

@Mahares Thank you for the reply. I will test it but I'm not able to understand it. If it will work on the device and raises an error on the emulator than there must be something wrong or incompatible with the library code.

>>>>>> Are there no other comments from the audiance neither from the developer team? <<<<<<<<<<<<<
 
Upvote 0
Top