Android에서도 UI관련 행위는 UI Thread위에서 해야한다
그렇지 않으면 아래와 같은 Exception이 발생한다

android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created .....

Swing의 SwingUtilities.invokeLater(Runnable r)와 같은 역할을 하는 아래의 방법을 사용하여 해결할수 있다

Activity.runOnUiThread(Runnable action)

View.post(Runnable action)

View.postDelayed(Runnable action, long delayMillis)

Handler.post(Runnable action)

저작자 표시 비영리 변경 금지
Posted by 유야
TAG

댓글을 달아 주세요