HTC Evo runs slow after application exit

dastinker8

Member
Licensed User
Longtime User
For some reason after the exit of my application either, when connected in debug or not, the phone crawls so slow that it is almost impossible to do anything with it. At any point while the application is still running everything runs fine. I have tried having the usb connected and disconnected. In debug mode and out of debug mode.

When in debug mode when i hit the stop button in the debugger the application closes and the phone crawls.
When not in debug mode i have a menu item that calls ExitApplication to close it out. As soon as the button is pressed the phone starts to crawl.

The application uses bluetooth/serial. I have tried closing the stream and the bluetooth resources but this does not seem to help. Any ideas on what to try next?
I am running v 1.7 and the newest B4A bridge.

B4X:
astream.Close
serial1.StopListening   
serial1.Disconnect
ExitApplication
 
Last edited:

dastinker8

Member
Licensed User
Longtime User
From what i have found i can start my application and then directly close it. I can start my application connect to a bluetooth device and then close my application. However If i send or receive data then try and close my application that is when my phone hangs. Is there a special way to dispose of the Asyncstreams when closing the application?


I call astream.close before i exit the application?
 
Upvote 0

dastinker8

Member
Licensed User
Longtime User
Ok this has been driving me nuts. It is not the asyncstream that is the issue. I have recreated a new project using the older timer polling for data and the Phone crashes and burns STILL. It does not do it until it has received or sent data from the serial class and then the application ends.

Is it possible i have a corrupt serial library.

I attached my project too see if anyone else could try it and see if it crashes their phone.

Part of the app might not even work i was just copying and pasting in code from the serial example given. I just know you have to hit the connect button, make a successful connection, send 1 bye of data, Close the application and boom phone lags so bad it needs restarted.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm not sure if it is related, however there is a known bug in some HTC devices where the BytesAvailable doesn't return the correct value. This may cause your application to hang when it tries to read the stream.
AsyncStreams should solve this problem as it doesn't depend on this property.

Note, it is better to use File - Export as zip. Otherwise you are including many unnecessary files.
 
Upvote 0

dastinker8

Member
Licensed User
Longtime User
I'm not sure if it is related, however there is a known bug in some HTC devices where the BytesAvailable doesn't return the correct value. This may cause your application to hang when it tries to read the stream.
AsyncStreams should solve this problem as it doesn't depend on this property.

Note, it is better to use File - Export as zip. Otherwise you are including many unnecessary files.

In my first post i stated that i was using the Asyncstreams fucntion and it still hangs my phone upon exit. Its weird that the application works properly sending and receiving data. Its only when the application has to close that i see the problem. BTW all data that i have been passing has transfered across and displayed properly.
 
Upvote 0

dastinker8

Member
Licensed User
Longtime User
OK upon trying to figure out where in the world this thing is broken somehow i received a toast message. However i didn't catch all of the message and im not seeming to be able to replicate this.

Java.io.Ioexception :Bad File (then another word i didn't catch)

Upon research i found there is a bad file descriptor Java Exception that happens upon closing I/O File streams.

This bug was not in Sun's 1.4 JDK, but was introduced in 1.5 when the error code from close was detected. The bug in is all 1.5 versions through 1.5.11 as well as 1.6

Java Bad File Descriptor Close Bug

Am i the only one having issues with this?????
 
Upvote 0
Top