slow things down

melamoud

Active Member
Licensed User
Longtime User
Guys,

I have a service that bring information from the internet using HTTP (HTTPUtil2)
I'm doing processing on the received data and it slowing down my phone dramatically,

the background processing is not something the user is waiting for, so it should run in "a lower priority" and not taking over the phone,

whats the best way to do this?
is this a CPU thing, or just the use of the UI thread (so use of threading might solve it)
BTW the whole phone is slow not just the specific app

thanks
 

melamoud

Active Member
Licensed User
Longtime User
Search it using regexp and put the result in a database.

I started with all jobs at the same time and moved to one job at a time still no improvement.
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
Can you post the code?

the regexp part for each page:
B4X:
m = Regex.Matcher("<title>(.*?)</title>",page)
   Do While m.find   
      Dim s = m.Group(1)
      If (s <> "" AND s<>Null) Then
         'Utilities.LogM(0,"Parsing:Adding song:" & s) ' check if more than one is found!!!
         If (songs.songs.IndexOf(s) = -1) Then songs.songs.Add(s) ' add the song only if not exist (prevent duplications as much as posisble)
      Else
         Utilities.LogM (0,"Cant find song, strange should not be possible" & m)
      End If
   Loop
   Return songs

need anything else ?
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
How large is the text?

Note that a Map is more suitable for such task. You can just add the keys with empty values.

you are correct but for now (debug) I need the order.
eachpage is about 300-400 lines of text (xml)
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
I did and the problem was inserting the result to the check without a transaction

Problem solved thanks

Good tip on the map thanks
 
Upvote 0
Top