Android Question Threads And Activity

Slacker

Active Member
Licensed User
Longtime User
Hello Folks,
I Know, excluding the use of Thread Library, That Android App runs on 1 GUI Thread. The question is, if i use a Service which get data from server and i pass this data to an activity is performing an Http Request and subsequent "JobDone Sub", the call on the Activity Sub method from the Service, is enqueued until the JobDone Sub (or other Sub) is finished its execution ?

Thank you ! :)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I Know, excluding the use of Thread Library, That Android App runs on 1 GUI Thread
That is not correct. Many of the libraries use background threads. That includes the Http (or HttpUtils2) library. Otherwise the whole app would have freezed.

I'm not sure that I understand your question. However your code always run in the main thread so you do not need to worry about multithreading issues.
It doesn't matter whether you use services or activities.
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
That is not correct. Many of the libraries use background threads. That includes the Http (or HttpUtils2) library. Otherwise the whole app would have freezed.

I'm not sure that I understand your question. However your code always run in the main thread so you do not need to worry about multithreading issues.
It doesn't matter whether you use services or activities.

Image code in JobDone Sub is running; in that moment, a Sevice Sub code get data and call a Sub in the previous activity is perfoming code in JobDone. What's happen ? Is there a syncronized behavior or i have to do it manually with Lock and other stuff ?
 
Upvote 0
Top