Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Is each UI thread in an Activity a separate threads?

In an Android app with multiple Activities, is each activity's UI thread a separate thread or are they actually the same thread (like a global, per app UI thread)?

like image 803
zer0stimulus Avatar asked Jul 20 '10 13:07

zer0stimulus


People also ask

Is UI thread main thread?

It is also almost always the thread in which your application interacts with components from the Android UI toolkit (components from the android. widget and android. view packages). As such, the main thread is also sometimes called the UI thread.

Is an activity a thread?

So is an activity is an independent thread? Yes and no. An Android app with one Activity will have a single process and single thread but if there are multiple app components they will normally all use the same thread (except for certain Android classes which use their own threads to do work).

Is Android multi threaded?

Concurrency means running multiple tasks in parallel, it is one of the main reasons that we use threads. As Android is a single-threaded model, we need to create different threads to perform our task and post the result to the main thread where the UI gets updated.

How does Android OS support multiple threads?

Developers multithread Android applications in order to improve their performance and usability. By spinning off processor- or resource-intensive tasks into their own threads, the rest of the program can continue to operate while these processor intensive tasks finish working.


1 Answers

Each application has one UI thread, which is used to run whichever Activity is in the foreground.

There is some more information here:

http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html

http://android-developers.blogspot.co.il/2009/05/painless-threading.html

like image 85
Captain Blammo Avatar answered Sep 20 '22 19:09

Captain Blammo