Android Question SOLVED: App aborting when using Dialog to edit (and range check) a number

Misterbates

Active Member
Licensed User
I have an app that presents a user with a list of properties (similar to fields in a database record) using CustomListView. It enables the user to click on a row to edit the property value and uses the Dialogs (4.01) library compiled under B4A 7.30 to process the edit.

It was working well, but then I renamed a few of the app modules/classes and now it works when editing a text item but aborts when editing a number item - where I'm using an EditText and processing the Changed event to validate the number, setting a red border if invalid and a white border if valid.

Here's the log from the full app.
Starting remote logger. Port: 11984
HWUI GL Pipeline
QUALCOMM build : 7142022, Ib5823dd10c
Build Date : 06/23/17
OpenGL ES Shader Compiler Version: EV031.18.00.00
Local Branch : O11A
Remote Branch :
Remote Branch :
Reconstruct Branch :
sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8994.so from the current namespace instead.
PFP: 0x00000000, ME: 0x00000000
Initialized EGL, version 1.4
Swap behavior 2
*** Debugger waiting for connection (0) ***
sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8994.so from the current namespace instead.
*** Debugger waiting for connection (1) ***
After accept
** Activity (main) Create, isFirst = true **
Class not found: ScB.Misterbates.PropertyEditor.propertyeditorview, trying: ScB.MisterBates.PropertyEditorExample.propertyeditorview
** Activity (main) Resume **
Do partial code cache collection, code=28KB, data=23KB
After code cache collection, code=28KB, data=23KB
Increasing code cache capacity to 128KB
Do partial code cache collection, code=57KB, data=51KB
After code cache collection, code=57KB, data=51KB
Increasing code cache capacity to 256KB
Deoptimizing void anywheresoftware.b4a.objects.ViewWrapper.innerInitialize(anywheresoftware.b4a.BA, java.lang.String, boolean) due to JIT inline cache
Skipped 84 frames! The application may be doing too much work on its main thread.
Do full code cache collection, code=122KB, data=86KB
After code cache collection, code=107KB, data=71KB
Background concurrent copying GC freed 51167(4MB) AllocSpace objects, 0(0B) LOS objects, 50% free, 16MB/32MB, paused 253us total 134.597ms
Background concurrent copying GC freed 142171(15MB) AllocSpace objects, 0(0B) LOS objects, 28% free, 61MB/85MB, paused 148.829ms total 539.296ms
Background concurrent copying GC freed 656857(46MB) AllocSpace objects, 10(10MB) LOS objects, 33% free, 47MB/71MB, paused 295us total 199.755ms
java.lang.StackOverflowError: stack size 8MB
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:452)
at java.lang.StringBuilder.append(StringBuilder.java:137)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:557)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at java.util.AbstractMap.toString(AbstractMap.java:559)
at anywheresoftware.b4a.objects.collections.Map$MyMap.toString(Map.java:284)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder
Message longer than Log limit (4000). Message was truncated.
null: 1723
Background concurrent copying GC freed 608813(43MB) AllocSpace objects, 0(0B) LOS objects, 22% free, 82MB/106MB, paused 263us total 273.651ms
Error occurred on line: 715 (PropertyEditorItem)
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at anywheresoftware.b4a.agraham.dialogs.InputDialog.setButtons(InputDialog.java:2362)
at anywheresoftware.b4a.agraham.dialogs.InputDialog$CustomLayoutDialog.createDialog(InputDialog.java:2436)
at anywheresoftware.b4a.agraham.dialogs.InputDialog$CustomLayoutDialog.ShowAsync(InputDialog.java:2384)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24697)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
null: 1727
java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:203)
at java.net.SocketInputStream.read(SocketInputStream.java:139)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
at java.io.BufferedInputStream.read(BufferedInputStream.java:267)
at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
at java.lang.Thread.run(Thread.java:764)

In an attempt to reproduce the issue for posting here, I cut down the app to bare essentials (attached). The cut-down version doesn't abort, but it does still log some issues that are similar to the full app - here's the log from the cut down version.
Starting remote logger. Port: 35321
HWUI GL Pipeline
QUALCOMM build : 7142022, Ib5823dd10c
Build Date : 06/23/17
OpenGL ES Shader Compiler Version: EV031.18.00.00
Local Branch : O11A
Remote Branch :
Remote Branch :
Reconstruct Branch :
sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8994.so from the current namespace instead.
PFP: 0x00000000, ME: 0x00000000
Initialized EGL, version 1.4
Swap behavior 2
*** Debugger waiting for connection (0) ***
sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8994.so from the current namespace instead.
*** Debugger waiting for connection (1) ***
After accept
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
TextValue=Hello!
Do partial code cache collection, code=28KB, data=20KB
After code cache collection, code=28KB, data=20KB
Increasing code cache capacity to 128KB
NumberValue=3456.0
Unexpected event (missing RaiseSynchronousEvents): tfnumber_textchanged
Check the unfiltered logs for the full stack trace.
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1346)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:306)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.objects.EditTextWrapper$1.afterTextChanged(EditTextWrapper.java:83)
at android.widget.TextView.sendAfterTextChanged(TextView.java:9375)
at android.widget.TextView.setText(TextView.java:5401)
at android.widget.TextView.setText(TextView.java:5248)
at android.widget.EditText.setText(EditText.java:113)
at android.widget.TextView.setText(TextView.java:5205)
at android.widget.TextView.setTransformationMethod(TextView.java:2522)
at android.widget.TextView.applySingleLine(TextView.java:9056)
at android.widget.TextView.setInputType(TextView.java:5647)
at anywheresoftware.b4a.objects.EditTextWrapper.setInputType(EditTextWrapper.java:187)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:259)
at ScB.MisterBates.PevDlgIssue.slimlineeditoritem$ResumableSub_ChangeItem.resume(slimlineeditoritem.java:80)
at ScB.MisterBates.PevDlgIssue.slimlineeditoritem._changeitem(slimlineeditoritem.java:62)
at ScB.MisterBates.PevDlgIssue.main._activity_resume(main.java:426)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at ScB.MisterBates.PevDlgIssue.main.afterFirstLayout(main.java:108)
at ScB.MisterBates.PevDlgIssue.main.access$000(main.java:17)
at ScB.MisterBates.PevDlgIssue.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Skipped 31 frames! The application may be doing too much work on its main thread.
NumberValue=3456.0 (Changed=false)
TextValue=Hello! (Changed=true)
** Activity (main) Pause, UserClosed = false **

Why would editing a text item using the dialog library work with no issues, but editing a number item (and using the changed event) cause issues?

Thanks in advance for any help/advice/pointers!
 

Attachments

  • PevDlgIssue.zip
    126.5 KB · Views: 260

Misterbates

Active Member
Licensed User
Found the issue. Wasn't with the Dialogs library at all, was with another part of my code that I changed at the same time but didn't test!
 
Upvote 0
Top