App Becomes Sluggish Over Time

Bill Norris

Active Member
Licensed User
Longtime User
I am finding that after a full day or so that my app is running (it is the only app on the tablet that is permitted to run, so no others are running other than android system stuff), it begins to respond sluggishly. Scroll views that normally scroll smoothly begin to scroll "choppy". I find that I have to go to settings and force-close the app. When it relaunches, all is well. Am wondering if there is any solution to having to force-close the app daily to restore the smooth functionality.
 

JonPM

Well-Known Member
Licensed User
Longtime User
We would need more details as to what your app is doing exactly. What kinds of functions are running, are there many graphics, etc. There could be ways to optimize your code.
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
Is it possible there's a memory leak?

They can be real mongrels to find and do cause issues like that or random crashing.

Can you tell us in more detail what your app does?

You mentioned that scrollviews scroll choppy - what other things are happening?

regards, Ricky
 
Upvote 0

rbsoft

Active Member
Licensed User
Longtime User
I had a similar problem once with a program using a webview. It accumulated an enourmous amount of cached data. Maybe your are running into a similar problem.

Rolf
 
Upvote 0

Bill Norris

Active Member
Licensed User
Longtime User
RE:

In response to Ricky D. Besides the "choppy" scrolls, the main other issue is see is: I have one activity with several buttons that I use a timer to alternate their colors one at a time to draw attention to them. Normally, each button changes color for about half second, then back to original color, then the next button does the same, then the next, etc. I notice over time that the flash intervals become irregular. This is not the case when the app first launches - they all behave perfectly.
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
I was having a couple of posts on "B4A slowing down when WiFi bridge is not connected". In my case that happens immediately when disconnecting the bridge, but I am continously transferring kbytes of data at high speed. Maybe, if there is less traffic, slowing down takes longer to set in, if the bridge were an issue also in Bill's case. There was no solution offered so far, except that people claim that the bridge code seems to suffer.
Regards, positrom2
 
Upvote 0

cammel8

Member
Licensed User
Longtime User
I have one activity with several buttons that I use a timer to alternate their colors one at a time to draw attention to them. Normally, each button changes color for about half second, then back to original color,

Is it possible your timer is causing problems. Every time I use a timer it seams to give me problems. Couldn't you use an imagview to display a animated .gif to make it look like a button that is blinking then just overlay a transparent button over that. That would eliminate the need of a timer to change it. It would also use sless system resources.
B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

Dim Imageview1 As ImageView
Dim Bitmap1 As Bitmap
Dim button1 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)



Imageview1.Initialize("")
Bitmap1.Initialize(File.DirAssets, "nameoffile.gif")
Imageview1.Bitmap = Bitmap1
Imageview1.Gravity = Gravity.FILL
Activity.AddView(Imageview1,0,0, 50%x,50%y)
button1.Initialize("button1")
button1.Color=Colors.Transparent
Activity.AddView(button1,0,0,50%x,50%y)


End Sub
Sub button1_Click
   ToastMessageShow("Button Clicked",False)
End Sub
 
Upvote 0

Bill Norris

Active Member
Licensed User
Longtime User
RE:

I'm gonna look into that because not that you mention it I've had timer issues in the past. Maybe I'll just start by disabling the timers and see what is the effect.

Thanks!
 
Upvote 0
Top