Edittext slows down program execution

positrom2

Active Member
Licensed User
Longtime User
Hello,
I am using edittext. When I tap into the window to enter text the program execution slows down and remains slow also after having hit the return key (the keyboard vanishs but the edittext cursor stays blinking). Is there a way to bring edittext to the state before a key has been pressed?
thanks, positrom2
 

positrom2

Active Member
Licensed User
Longtime User
Erel,
Maybe you are doing something with it that causes the program to slow down.
This is all what edittext refers to:

B4X:
Dim edtCommts As EditText
Dim lblCommts As Label

Sub edtCommts_TextChanged (Old As String, New As String)
lblCommts.Text=New   
End Sub

Is it possible to switch off the blinking cursor in the edittext window, I mean to close edittext?

Thanks, positrom2
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Do you want to perhaps disable the text box.
B4X:
Sub edtCommts_TextChanged (Old As String, New As String)
       lblCommts.Text=New    
       'Below disable the edit text box
       EdtCommts.enable=false
End Sub
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
Mahares, Erel,
thank you. Your suggestion closes the edittext. But it does not solve the problem of slowing down program execution. That stays slow also after disabling edittext. Entering text seems to trigger some condition that causes execution to become slow. Starting the program and letting it run without entering text, after a while, it is getting as slow as after entering text. Must be due to some buffers or stacks since the program always works in the "fast" condition for a while and then switches to the "slow" mode -reproducibly after text entering- random without. Since data transmission is involved, I think I must use a logic analyser to see if something changes in the data transmission.
Regard, positrom2
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
what do you do with lblCommts by the way? Is there any chance that you set your Edtcommts based on the value of lblCommts?
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
Is there any chance that you set your Edtcommts based on the value of lblCommts?
No, there are no other references than those listed in my post above (see 3rd post in this thread). I think most people would not realize if a program runs more slow as long as it does not crash. But here I am monitoring its reaction by an oscilloscope. Each program run is initiated by a B4A timer asking a µC to do something that I can monitor. So, the B4A timer, is it rock-hard?
regards, positrom2
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
I was indeed just referring to the question of timer accuracy. If the timer were software based, might it be interrupted momentarily when a new task is generated (e.g., edittext)? The larger the processor load is (running tasks -don't know the terminology) would it slow down?
Thanks, positrom2
 
Upvote 0

PhilN

Member
Licensed User
Longtime User
Yep. I had a similar problem. I'm using Async Streams comms to a proprietary hardware device over Bluetooth. After receiving about 400 data requests from my Samaung Galaxy SII, there is a noticable slowing down of the app. The data requests are at 0.5 s intervals via the Timer which is quite sparse. The data sent is always 4 char and the data received varies between 12 and 15 char depending on the data request command. At first I thought it was my graph drawing routine which I disabled. Still the same. I'm starting to think that there must be some accumulation of arrays or something... Question: What happens when you re-dimension a global byte array to a different size with every data set received?

I'm still trouble shooting. If I resolve it, I'll post my resolve.
 
Upvote 0

PhilN

Member
Licensed User
Longtime User
Ok. After disabling posts to the EditText view, the app does not slow down anymore!

Note: I did limit the EditText view text to less than 500 char by using .Remove from the RichStringBuilder. This did not help.
 
Upvote 0

PhilN

Member
Licensed User
Longtime User
OK. After some more work, I've realized that the problem might lie with using the RichStringBuilder to post RichString's to the EditText view. If I don't use the RSB and I keep adding normal string segments together e.g. txtLog.Text = txtLog.Text & newtext, the app runs perfectly fine. No slowing down. Of course there is a limit to the text length of an EditText view.
 
Upvote 0
Top