์ ๋ฐ์ํ ๊น?
In Android, application responsiveness is monitored by the Activity Manager and Window Manager system services. Android will display the ANR dialog for a particular application when it detects one of the following conditions:
๊ตฌ๊ธ ๋ฌธ์์์ ์ฐพ์ ๋ณผ ์ ์๋ค.
์๋๋ก์ด๋์์, ์ดํ๋ฆฌ์ผ์ด์
์๋ต์ ActivityManager์ WindowManger System์์ ๊ด์ฐฐ์ ํ๋ค. ์๋๋ก์ด๋๋ ๋ค์๊ณผ ๊ฐ์ ํน์ ์กฐ๊ฑด์ด ๋ฐ๊ฒฌ๋๋ฉด ANR ๋ค์ด์ผ๋ก๊ทธ๋ฅผ ๋์ฐ๊ฒ ๋๋ค.
ํผํด์ผ์ง ANR
any method that runs in the UI thread should do as little work as possible on that thread. In particular, activities should do as little as possible to set up in key life-cycle methods such as onCreate() and onResume(). Potentially long running operations such as network or database operations, or computationally expensive calculations such as resizing bitmaps should be done in a worker thread (or in the case of databases operations, via an asynchronous request).
UI ๋ณ๋์ด ์์ ๋๋ ํ๋ก๊ทธ๋์ค ๋ฐ์ ๊ฐ์ ํ๋ฉด์ผ๋ก ์ฌ์ฉ์์๊ฒ ์๋ ค์ฃผ์.
์์ ๋ฐ์ํ์ง ์์ ์ ์๋ค. = ๋ฐ์ํ ๊ฐ๋ฅ์ฑ์ด ์๋ค.
๊ธฐ๊ธฐ์ ๋ฐ๋ผ ๋ค๋ฅด๊ธฐ์ ๊ฐ๋ฐ์์ ์ญ๋์ ์ด๋ฅผ ์ต์ํ ํ๋ ๊ฑฐ๋ผ๊ณ ์๊ฐํ๋ค.
(๋๋ ๊ฐ๋ ์ดํ์ ์ฐ๋ค๋ณด๋ฉด ํญํ๊ณ ๊บผ์ง๋๊ฐ ์๋ค.)
์ฌ์ฉ์์๊ฒ ์ด๋ฌํ ๊ฒฝํ์ ์ต์ํ ์ํค๋๊ฒ ๊ฐ๋ฐ์์ ์ผ์ด๋ผ๊ณ ์๊ฐํ๋ค.