现在的位置: 首页 > 综合 > 正文

android in practice_Threads and concurrency

2017年12月24日 ⁄ 综合 ⁄ 共 685字 ⁄ 字号 评论关闭

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.

抱歉!评论已关闭.