Android Question Errors using AutoTextSizeLabel module

Martincg

Member
Licensed User
Longtime User
I am trying to use the AutoTextSizeLabel custom view class module. I get errors which occur when the main program sets the text.
I cannot see what is wrong. The sample provided by Erel works for me. The AutoTextSizeLabel module has the original code, with commented out code I modified at the end which I thought might be causing the problem.
Could someone try my project and let me know what I should be doing please.

I also need to create labels with larger textsize than the module allows for. It limits to a maximum of 80. I tried changing this to 120 but the program slowed a lot. Maybe because it takes a long time working out the text size. Because of this I wonder if the problem is related to the fact that I have 6 of these labels and their sizes are all set in the layout script. Do the functions in the custom view module need to have "wait for"s ? (I have no experience of using wait for yet.)
 

Attachments

  • AutoTextSizeLabelProb.zip
    92.9 KB · Views: 125

Martincg

Member
Licensed User
Longtime User
I tried CTRL P and then the first time the project ran without errors. Second time I ran it the errors were back and then CTRL P made no difference.
I get the two errors shown below. The second error refers to line 90 which is the "End Sb" line of a timer handler. This is strange to me because the error shows before the timer will have reached its interval. I increased the interval 60 seconds, did CTRL P and ran it again. The errors appear as soon as the app is started.
EDIT: The "Line 90 (Main)" is not related to the timer firing because even if the timer is never enabled that error occurs.
Logger connected to: asus Nexus 7
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **

Error occurred on line: 46 (AutoTextSizeLabel)
java.net.SocketException: sendto failed: EBADF (Bad file descriptor)
at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:542)
at libcore.io.IoBridge.sendto(IoBridge.java:511)
at java.net.PlainSocketImpl.write(PlainSocketImpl.java:500)
at java.net.PlainSocketImpl.-wrap1(PlainSocketImpl.java)
at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266)
at java.io.BufferedOutputStream.flushInternal(BufferedOutputStream.java:185)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:85)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:88)
at java.io.DataOutputStream.flush(DataOutputStream.java:63)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:757)
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:144)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.autotextsizelabel._settext(autotextsizelabel.java:43)
at b4a.example.main._timtic_tick(main.java:509)
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:144)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.system.ErrnoException: sendto failed: EBADF (Bad file descriptor)
at libcore.io.Posix.sendtoBytes(Native Method)
at libcore.io.Posix.sendto(Posix.java:211)
at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
at libcore.io.IoBridge.sendto(IoBridge.java:509)
... 29 more

** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **

Error occurred on line: 90 (Main)
java.net.SocketException: sendto failed: EBADF (Bad file descriptor)
at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:542)
at libcore.io.IoBridge.sendto(IoBridge.java:511)
at java.net.PlainSocketImpl.write(PlainSocketImpl.java:500)
at java.net.PlainSocketImpl.-wrap1(PlainSocketImpl.java)
at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266)
at java.io.BufferedOutputStream.flushInternal(BufferedOutputStream.java:185)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:85)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:88)
at java.io.DataOutputStream.flush(DataOutputStream.java:63)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:757)
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:144)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.system.ErrnoException: sendto failed: EBADF (Bad file descriptor)
at libcore.io.Posix.sendtoBytes(Native Method)
at libcore.io.Posix.sendto(Posix.java:211)
at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
at libcore.io.IoBridge.sendto(IoBridge.java:509)
... 20 more

** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
 
Last edited:
Upvote 0

Martincg

Member
Licensed User
Longtime User
After more strange problems such as logs reported to come from lines which didn't have "log" I tried using my phone and no errors.
I installed an task killer on my tablet and got rid of various tasks. Now everything is working again. Maybe a coincidence I don't know.

Edit:
The errors keep coming back. But I've found that if every time I get these errors I uninstall the app,then the next time the errors have gone.
 
Last edited:
Upvote 0
Top