android in practice_Threads and concurrency

来源:互联网 发布:三星s5230c软件下载 编辑:程序博客网 时间:2024/06/03 16:16

you can run services in separate processes, but that isn’t a requirement. In fact, unless you specify a process ID explicitly, they won’t.

one golden rule about user interfaces is to always remain responsive.

When launching your application, Android will spawn a single system process running a single thread of execution.this thread is called the main application thread,
main user interface thread, or UI thread.

Writing code like this may freeze your application—Android can’t continue drawing your application’s user interface until the download completes because both download and UI code run in the same thread.

Any non-blocking or fast operation is fine to execute on the main application thread that’s running when an application starts. Anything else should be executed on a different thread.

原创粉丝点击